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

:root {
    --bg-gradient: #f4f5f7;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    
    --primary-color: #e3000f; /* Vermelho SESI SENAI */
    --primary-hover: #b3000c;
    
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    
    --success-bg: rgba(5, 150, 105, 0.1);
    --warning-bg: rgba(217, 119, 6, 0.1);

    --border-color: #e5e7eb;
    --border-solid: #d1d5db;
    --input-bg: #ffffff;

    --font-family: 'Outfit', sans-serif;
    --transition-speed: 0.25s;
}

[data-theme="dark"] {
    --bg-gradient: #111827;
    --card-bg: #1f2937;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    
    --primary-color: #e3000f;
    --primary-hover: #ff2a38;
    
    --border-color: #374151;
    --border-solid: #4b5563;
    --input-bg: #111827;
    
    --success-bg: rgba(5, 150, 105, 0.2);
    --warning-bg: rgba(217, 119, 6, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-primary);
    transition: background 0.5s ease, color 0.5s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.2;
}

p {
    color: var(--text-secondary);
}

.hidden {
    display: none !important;
}

/* Cards Clean Design */
.card {
    background: var(--card-bg);
    border-radius: 8px; /* Mais quadrado, menos curvo */
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: background-color var(--transition-speed);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all var(--transition-speed);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-solid);
}

.btn-secondary:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-success, .btn-warning {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    font-weight: 600;
}

.btn-success { background-color: var(--success-color); color: white; }
.btn-warning { background-color: var(--warning-color); color: white; }

.btn-logout {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.875rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* Inputs */
.input-group {
    margin-bottom: 1.25rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-solid);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all var(--transition-speed);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.error-message {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- Login Page --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

/* --- Theme Toggle --- */
.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);

    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-size: 1.5rem;
    z-index: 1000;
    transition: transform var(--transition-speed), background var(--transition-speed);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
}

/* --- Dashboard --- */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.app-header {
    padding: 1.25rem 2rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand h1 { font-size: 1.4rem; }

.subtitle {
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #111827; /* Fundo escuro para destacar */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}
[data-theme="dark"] .user-avatar {
    background: #f9fafb;
    color: #111827;
}

.dashboard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-solid);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: all 0.2s;
    font-family: var(--font-family);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-solid);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    font-family: var(--font-family);
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-speed);
}

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

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -0.6rem;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px;
}

/* Table */
.equipment-list-section {
    padding: 2rem;
}

.table-responsive {
    overflow-x: auto;
}

.equipment-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.equipment-table th, .equipment-table td {
    padding: 1.25rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-solid);
}

.equipment-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.equipment-table td {
    vertical-align: middle;
}

.equipment-table tbody tr {
    transition: background-color 0.2s;
}

.equipment-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .equipment-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 0.4rem;
}

.status-available {
    background-color: var(--success-bg);
    color: var(--success-color);
}

.status-borrowed {
    background-color: var(--warning-bg);
    color: var(--warning-color);
}

.text-right { text-align: right !important; }
.actions-cell { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);

    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    padding: 0;
    overflow: hidden;
    transform: translateY(0);
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-solid);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover { color: var(--danger-color); }

.modal-body { padding: 2rem; }

.modal-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-solid);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 3000;
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.notification-content {
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideInRight { from { transform: translateX(120%); } to { transform: translateX(0); } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@media (max-width: 1024px) {
    .app-container {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .app-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .user-controls {
        width: 100%;
        justify-content: center;
        margin-top: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }

    .brand img {
        width: 35px;
    }

    .brand h1 {
        font-size: 1.2rem;
    }

    /* Stack Admin Buttons */
    #adminSection {
        flex-direction: column;
        gap: 0.75rem;
    }

    #adminSection .btn {
        width: 100%;
    }

    .dashboard-actions {
        flex-direction: column;
        padding: 1rem;
    }

    .search-box {
        max-width: 100%;
    }

    /* --- Responsive Table Cards --- */
    .equipment-list-section {
        padding: 1rem;
    }

    .section-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
    }

    /* Hide Headers */
    .equipment-table thead {
        display: none;
    }

    /* Row as Card */
    .equipment-table, .equipment-table tbody, .equipment-table tr, .equipment-table td {
        display: block;
        width: 100%;
    }

    .equipment-table tr {
        margin-bottom: 1.5rem;
        border: 1px solid var(--border-color);
        border-radius: 12px;
        background: var(--card-bg);
        overflow: hidden;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .equipment-table td {
        text-align: right;
        padding: 0.75rem 1rem;
        position: relative;
        border-bottom: 1px solid var(--border-color);
        min-height: 45px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .equipment-table td:last-child {
        border-bottom: none;
        background: rgba(0,0,0,0.02);
        justify-content: flex-end;
    }

    [data-theme="dark"] .equipment-table td:last-child {
        background: rgba(255,255,255,0.02);
    }

    /* Label via Data Attribute */
    .equipment-table td::before {
        content: attr(data-label);
        font-weight: 700;
        text-transform: uppercase;
        font-size: 0.7rem;
        color: var(--text-secondary);
        letter-spacing: 0.05em;
        text-align: left;
    }

    .equipment-table tr:hover {
        background-color: var(--card-bg);
    }

    /* Scrollable Tabs Refinement */
    .tabs-container {
        padding-bottom: 8px;
        margin-bottom: 1.5rem;
        gap: 0.5rem;
    }

    .tab-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .actions-cell {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Modals */
    .modal-content {
        max-width: 95%;
        margin: auto;
    }
    
    .modal-body {
        padding: 1.25rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }

    #loanForm div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 1.25rem !important;
    }
}
