@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #ea580c; /* Warm Safety Orange */
    --primary-hover: #c2410c;
    --primary-light: #fff7ed;
    --primary-dark: #7c2d12;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;
    
    --bg-app: #f4f6f9;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(234, 88, 12, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ==================== LOGIN ==================== */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: radial-gradient(circle at 10% 20%, rgba(124, 45, 18, 0.05) 0%, rgba(234, 88, 12, 0.08) 90%), #0f172a;
    padding: 20px;
    overflow: hidden;
    position: relative;
}

/* Decorações de Fundo do Login */
.login-body::before, .login-body::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: var(--primary);
    filter: blur(120px);
    opacity: 0.15;
    z-index: 1;
}
.login-body::before { top: -50px; right: -50px; }
.login-body::after { bottom: -50px; left: -50px; }

.login-container {
    width: 100%;
    max-width: 420px;
    z-index: 2;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg), 0 30px 60px -15px rgba(0, 0, 0, 0.3);
    animation: loginCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginCardIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.login-title {
    text-align: center;
    color: var(--neutral-900);
    font-size: 1.8rem;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

/* ==================== ALERTAS ==================== */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    animation: alertIn 0.3s ease-out;
}

@keyframes alertIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger-hover);
    border-color: rgba(239, 68, 68, 0.2);
}

/* ==================== FORMULÁRIOS ==================== */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--neutral-700);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--neutral-900);
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-control {
    padding-right: 48px;
}

.btn-toggle-password {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-toggle-password:hover {
    color: var(--primary);
}

.btn-toggle-password svg {
    width: 20px;
    height: 20px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* ==================== BOTÕES ==================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    height: 48px; /* Tapped area rule */
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 14px rgba(16, 185, 129, 0.35);
}

.btn-secondary {
    background: var(--neutral-100);
    color: var(--neutral-700);
}

.btn-secondary:hover {
    background: var(--neutral-200);
}

.btn-block {
    width: 100%;
}

.btn-icon {
    background: var(--neutral-100);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--neutral-800);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--neutral-200);
    color: var(--neutral-900);
    transform: translateY(-2px);
}

.btn-edit {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
}

.btn-edit:hover {
    background: var(--primary);
    color: #fff;
}

/* ==================== HEADER ==================== */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--neutral-200);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.header-info strong {
    color: var(--neutral-900);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.header-user {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ==================== BUSCA ==================== */

.search-container {
    margin-bottom: 20px;
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 46px;
    background: #fff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    color: var(--neutral-900);
    font-family: inherit;
    outline: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    pointer-events: none;
}

/* ==================== MAIN ==================== */

.app-main {
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.list-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--neutral-900);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.list-count {
    background: var(--neutral-100);
    color: var(--neutral-700);
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

/* ==================== DESKTOP TABLE ==================== */

.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--neutral-200);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead th {
    background: var(--neutral-50);
    padding: 16px 20px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--neutral-200);
    letter-spacing: 0.05em;
}

.table tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--neutral-100);
    font-size: 0.9rem;
    color: var(--neutral-700);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--neutral-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

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

/* ==================== MOBILE CARDS ==================== */

.mobile-cards-container {
    display: none;
    flex-direction: column;
    gap: 16px;
}

.mobile-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-200);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mobile-card:active {
    transform: scale(0.99);
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.mobile-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-req-number {
    font-size: 1rem;
    font-weight: 800;
    color: var(--neutral-900);
}

.card-req-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--neutral-100);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.875rem;
}

.card-info-row {
    display: flex;
    gap: 6px;
    color: var(--neutral-700);
}

.card-info-label {
    font-weight: 700;
    color: var(--text-muted);
    min-width: 55px;
}

.card-description {
    background: var(--neutral-50);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--neutral-700);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-top: 4px;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
}

.card-footer .btn-edit {
    width: 100%;
    justify-content: center;
    height: 44px;
    font-size: 0.9rem;
}

/* ==================== MODAL ==================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    max-width: 680px;
    width: 100%;
    box-shadow: var(--shadow-lg), 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--neutral-200);
    animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

@keyframes modalScaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--neutral-100);
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--neutral-900);
    letter-spacing: -0.01em;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    background: var(--neutral-100);
    padding: 4px;
    margin: 16px 24px 0 24px;
    border-radius: var(--radius-sm);
    gap: 2px;
}

.modal-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    border: none;
    background: transparent;
}

.modal-tab.active {
    background: #fff;
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--neutral-100);
    background: var(--neutral-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-footer .btn {
    flex: 1;
    max-width: 200px;
}

.modal-section {
    margin: 16px 0;
    border-bottom: 1px solid var(--neutral-100);
    padding-bottom: 16px;
}

.modal-section h3 {
    font-size: 1.05rem;
    color: var(--neutral-900);
    font-weight: 800;
    margin-bottom: 8px;
}

/* ==================== DETALHES ==================== */

.detalhes-info {
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    padding: 20px;
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--neutral-700);
    border: 1px solid var(--neutral-200);
}

.detalhes-info strong {
    color: var(--neutral-900);
}

/* ==================== STATUS TILES (MOBILE STATUS SELECT) ==================== */

.status-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.status-tile {
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    padding: 16px 8px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--neutral-700);
}

.status-tile:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.status-tile.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    box-shadow: 0 0 0 2px var(--primary);
}

.status-tile-icon {
    font-size: 1.4rem;
}

.status-tile[data-val="1"] .status-tile-icon { color: var(--primary); }
.status-tile[data-val="2"] .status-tile-icon { color: var(--danger); }
.status-tile[data-val="3"] .status-tile-icon { color: var(--warning); }

/* Hide default select on mobile but keep it accessible for DOM value */
.form-group-status select {
    display: none;
}

/* ==================== CONDITIONAL FIELDS ==================== */

.conditional-field {
    display: none;
    animation: fadeIn 0.3s ease;
}

.conditional-field.visible {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== FEEDBACK MESSAGES ==================== */

.toast-message {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--neutral-900);
    color: #fff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    z-index: 2000;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-message.success {
    border-left: 4px solid var(--primary);
}

.toast-message.error {
    border-left: 4px solid var(--danger);
}

/* ==================== RESPONSIVIDADE GENERALIZADA ==================== */

@media (max-width: 767px) {
    body {
        background: var(--neutral-50);
    }
    
    .app-header {
        padding: 12px 16px;
    }
    
    .app-main {
        padding: 16px;
    }
    
    .table-container {
        display: none;
    }
    
    .mobile-cards-container {
        display: flex !important;
    }
    
    /* Bottom Sheet Modal em Telas Móveis */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal-content {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-width: 100%;
        margin: 0;
        animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        max-height: 94vh;
        border-bottom: none;
    }
    
    @keyframes slideUp {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-tabs {
        margin: 12px 20px 0 20px;
    }
    
    .modal-body {
        padding: 16px 20px;
        max-height: calc(94vh - 140px);
    }
    
    .modal-footer {
        padding: 12px 20px;
        flex-direction: row;
        border-radius: 0;
    }
    
    .modal-footer .btn {
        max-width: none;
    }
    
    .detalhes-info {
        padding: 14px;
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .mobile-cards-container {
        display: none !important;
    }
    
    /* Hide custom status tiles in desktop standard modal to keep original look */
    .status-tiles {
        display: none !important;
    }

    /* Show standard select dropdown on desktop */
    .form-group-status select {
        display: block;
    }
}

/* ==================== FILTRO POR CENTRO ==================== */
.center-filter-container {
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.center-filter-container .filter-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.center-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 6px;
}

.filter-pill {
    background: var(--card-bg);
    color: var(--neutral-700);
    border: 1px solid var(--neutral-200);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.filter-pill:hover {
    background: var(--neutral-50);
    border-color: var(--neutral-400);
}

.filter-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.25);
}
