/* ===== RESET E FOUNDATION ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

/* ===== CONTAINER PRINCIPAL ===== */
.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
    font-size: 13px;
    opacity: 0.95;
}

.header-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== MAIN LAYOUT ===== */
.main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* ===== INPUTS E FORMS ===== */
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: #333;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

textarea {
    resize: vertical;
    font-family: 'Courier New', monospace;
}

input[type="checkbox"] {
    margin-right: 6px;
    cursor: pointer;
}

label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

/* ===== BOTÕES ===== */
.btn {
    padding: 8px 16px;
    background: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    background: #1976d2;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.secondary {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
}

.btn.secondary:hover {
    background: #e8e8e8;
    border-color: #999;
}

.btn.danger {
    background: #f44336;
}

.btn.danger:hover {
    background: #d32f2f;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

.btn.success {
    background: #4caf50;
}

.btn.success:hover {
    background: #388e3c;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 350px;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #2c3e50;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* ===== SIDEBAR GENÉRICO ===== */
.sidebar-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-label {
    font-size: 12px;
    font-weight: 500;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-title {
    font-weight: 600;
    font-size: 12px;
    color: #2196f3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2196f3;
}

/* ===== ANIMAÇÕES E TRANSIÇÕES ===== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ===== CLASSES UTILITÁRIAS ===== */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

.active {
    opacity: 1;
    visibility: visible;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: #999;
    font-size: 12px;
}

.text-error {
    color: #f44336;
}

.text-success {
    color: #4caf50;
}

.text-warning {
    color: #ff9800;
}

.text-info {
    color: #2196f3;
}

.mt-8 {
    margin-top: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-12 {
    margin-bottom: 12px;
}

.mb-16 {
    margin-bottom: 16px;
}

.gap-4 {
    gap: 4px;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

/* ===== SCROLLBAR CUSTOMIZADO ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ===== RESPONSIVE - TABLET ===== */
@media (max-width: 1024px) {
    header h1 {
        font-size: 20px;
    }

    .header-info {
        gap: 12px;
        font-size: 12px;
    }

    .modal-content {
        min-width: 80vw;
    }
}

/* ===== RESPONSIVE - MOBILE ===== */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    header h1 {
        font-size: 18px;
        order: 1;
        width: 100%;
    }

    .header-info {
        order: 2;
        gap: 12px;
        font-size: 11px;
        width: 100%;
    }

    .main {
        flex-direction: column;
        gap: 0;
    }

    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .modal-content {
        min-width: 90vw;
        min-height: auto;
        max-height: 85vh;
        padding: 16px;
    }

    .modal-title {
        font-size: 16px;
    }

    input[type="text"],
    textarea,
    select {
        font-size: 14px;
        padding: 10px;
    }

    .sidebar-label {
        font-size: 11px;
    }

    .sidebar-title {
        font-size: 11px;
    }
}

/* ===== RESPONSIVE - SMALL MOBILE ===== */
@media (max-width: 480px) {
    header {
        padding: 8px 12px;
    }

    header h1 {
        font-size: 16px;
    }

    .header-info {
        font-size: 10px;
        gap: 8px;
    }

    .btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .modal-content {
        min-width: 95vw;
        padding: 12px;
    }

    .modal-footer {
        flex-direction: column-reverse;
    }

    .modal-footer .btn {
        width: 100%;
    }

    input[type="text"],
    textarea,
    select {
        font-size: 13px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    header,
    .toolbar,
    .sidebar {
        display: none;
    }

    .workspace {
        border: none;
        background: white;
    }

    svg.canvas {
        background: white;
    }
}