/* Reset and Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #081028 0%, #0A1330 100%);
    color: #f5f5f5;
    font-family: 'Poppins', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    height: 100%;
    background-color: #081028;
    position: fixed;
    top: 0;
    left: -250px;
    padding-top: 20px;
    transition: left 0.3s ease;
    z-index: 2000;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar.open {
    left: 0;
}

.sidebar .logo {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.sidebar .logo img {
    width: 120px;
    height: auto;
}

.sidebar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.sidebar ul li {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.sidebar ul li a {
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 10px 0;
    transition: color 0.2s ease;
}

.sidebar ul li a i {
    margin-left: 9px;
}

.sidebar ul li a.active {
    background-color: #312ECB;
    color: white;
    border-radius: 5px;
}

.sidebar ul li a.active i {
    color: white;
}

.sidebar ul li a:hover {
    background-color: #312ECB;
    color: #fff;
    border-radius: 10px;
    transform: scale(1.05);
}

.sidebar .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: transparent;
    border: none;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
}

.sidebar .close-btn:hover {
    color: #e74c3c;
}

.sidebar-logo {
    max-width: 80%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Mobile Topbar */
.mobile-topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background-color: #081028;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: white;
}

.mobile-topbar i {
    font-size: 24px;
}

.sidebar-toggle {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
}

.sidebar-toggle.hidden {
    display: none;
}

.sidebar-toggle:hover {
    color: #1abc9c;
}

/* Header */
.header {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-menu button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
}

.profile-menu button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    pointer-events: none;
}

.profile-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    width: 150px;
    z-index: 300;
}

.profile-dropdown.open {
    display: flex;
}

.profile-dropdown a {
    text-decoration: none;
    color: #333;
    padding: 10px;
    text-align: left;
    transition: background-color 0.2s ease;
}

.profile-dropdown a:hover {
    background-color: #f2f2f2;
}

/* Credits */
.credits-display {
    position: fixed;
    top: 20px;
    left: 265px;
    background-color: #312ECB;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 14px;
    z-index: 2000;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
    transition: top 0.3s ease, right 0.3s ease, z-index 0.3s ease;
}

/* Main Content */
.main-content {
    margin-left: 0;
    padding: 20px;
    padding-top: 60px;
}

/* Statistics */
.stats {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.stat-card {
    flex: 1;
    min-width: 200px;
    max-width: 220px;
    background: linear-gradient(145deg, #0B1739, #1A2A6C);
    color: white;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card i {
    font-size: 40px;
    color: #BDC3C7;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 600;
}

.stat-card .stat-title {
    font-size: 0.9rem;
    color: #BDC3C7;
}

.stat-card.gray i { color: #BDC3C7; }
.stat-card.green i { color: #2ECC71; }
.stat-card.yellow i { color: #F1C40F; }
.stat-card.red i { color: #E74C3C; }

/* Expiring Card */
.expiring-card {
    margin: 30px 0;
    background: linear-gradient(145deg, #0B1739, #1A2A6C);
    color: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.expiring-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.expiring-card h2 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.expiring-card-headers {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    font-size: 1rem;
    font-weight: 600;
    color: #BDC3C7;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.expiring-card-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.expiring-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: background 0.3s ease;
}

.expiring-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.expiring-item span {
    font-size: 0.9rem;
    color: #f5f5f5;
    word-break: break-word;
}

/* Modern Table */
.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: transparent;
}

.modern-table th {
    background-color: #0A1330;
    color: #fff;
    border-bottom: 2px solid #312ECB;
    padding: 10px;
    text-align: left;
}

.modern-table td {
    background-color: #0B1739;
    padding: 10px;
    text-align: left;
    color: #BDC3C7;
    border-bottom: 1px solid #7f8c8d;
}

.modern-table th:nth-child(1), .modern-table td:nth-child(1) { width: 15%; }
.modern-table th:nth-child(2), .modern-table td:nth-child(2) { width: 15%; }
.modern-table th:nth-child(3), .modern-table td:nth-child(3) { width: 10%; text-align: center; }
.modern-table th:nth-child(4), .modern-table td:nth-child(4) { width: 10%; text-align: center; }
.modern-table th:nth-child(5), .modern-table td:nth-child(5) { width: 15%; }
.modern-table th:nth-child(6), .modern-table td:nth-child(6) { width: 10%; text-align: center; }
.modern-table th:nth-child(7), .modern-table td:nth-child(7) { width: 15%; }
.modern-table th:nth-child(8), .modern-table td:nth-child(8) { width: 20%; }

/* Status Cards */
.status-card {
    display: inline-block;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 4px;
    font-size: 14px;
    font-weight: bold;
    color: white;
}

.status-ativo {
    background-color: #2ECC71;
}

.status-bloqueado, .status-inativo {
    background-color: #E74C3C;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
}

.action-buttons button {
    color: #FFF;
    border: none;
    padding: 10px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.action-buttons button i {
    color: #FFF;
}

.editButton {
    background-color: #3498db;
}

.editButton:hover {
    background-color: #2980b9;
}

.deleteButton {
    background-color: #e74c3c;
}

.deleteButton:hover {
    background-color: #c0392b;
}

.resetButton {
    background-color: #F39C12;
}

.resetButton:hover {
    background-color: #E67E22;
}

.createButton {
    background-color: #2ECC71;
    color: #FFF;
    border: none;
    padding: 10px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.createButton:hover {
    background-color: #27AE60;
}

/* Search Card */
.search-card {
    background-color: #0A1330;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    padding: 15px;
    margin: 20px 10px;
    max-width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.search-card:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

.search-card form {
    flex: 1;
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-card input[type="text"],
.search-card select {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #7f8c8d;
    background-color: #0B1739;
    color: white;
    transition: all 0.3s ease;
}

.search-card input[type="text"]:focus,
.search-card select:focus {
    border-color: #312ECB;
    box-shadow: 0 0 5px rgba(49, 46, 203, 0.5);
}

.search-card button {
    padding: 10px 16px;
    border-radius: 4px;
    background-color: #312ECB;
    border: none;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.search-card button:hover {
    background-color: #16a085;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: transparent;
}

.modal-content {
    background: linear-gradient(145deg, #0B1739, #1A2A6C);
    color: white;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid #312ECB;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex-grow: 1;
}

.modal-body h2 {
    margin: 0 0 20px 0;
    font-size: 1.8rem;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.modal-grid.full-width {
    grid-column: span 2;
}

.modal-body label {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 10px 0 5px;
    text-align: left;
    color: #BDC3C7;
    font-weight: 500;
}

.modal-body label i {
    color: #312ECB;
}

.modal-body input,
.modal-body select,
.modal-body textarea {
    width: 100%;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #7f8c8d;
    background-color: #0B1739;
    color: white;
    margin-bottom: 10px;
    transition: border-color 0.3s ease;
}

.modal-body input:focus,
.modal-body select:focus,
.modal-body textarea:focus {
    border-color: #312ECB;
    outline: none;
}

.modal-body textarea {
    height: 120px;
    resize: vertical;
}

.modal-icon {
    font-size: 60px;
    color: #3498db;
    margin-bottom: 20px;
}

.modal-footer {
    padding: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 15px;
    background-color: #0A1330;
}

.modal-footer button {
    background: linear-gradient(90deg, #312ECB, #5D54F0);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.modal-footer button:hover {
    background: linear-gradient(90deg, #5D54F0, #312ECB);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(49, 46, 203, 0.5);
}

.modal-footer button:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(49, 46, 203, 0.3);
}

.modal-footer button.cancel {
    background: linear-gradient(90deg, #E74C3C, #C0392B);
}

.modal-footer button.cancel:hover {
    background: linear-gradient(90deg, #C0392B, #E74C3C);
}

/* Dashboard Specific Styles */
.dashboard-section {
    margin: 20px 0;
    background: linear-gradient(145deg, #0B1739, #1A2A6C);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.dashboard-section h2 {
    margin: 0 0 15px;
    color: #ffffff;
    font-size: 1.5rem;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.bulk-action-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bulk-action-form label {
    color: #BDC3C7;
}

.bulk-action-form select, .bulk-action-form button {
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #7f8c8d;
    background-color: #0B1739;
    color: white;
    cursor: pointer;
}

.user-checkboxes {
    max-height: 200px;
    overflow-y: auto;
    background-color: #0A1330;
    padding: 10px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.user-checkboxes label {
    color: #f5f5f5;
}

.charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
}

.chart-card {
    flex: 1;
    min-width: 300px;
    background-color: #0A1330;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.logs-container {
    max-height: 300px;
    overflow-y: auto;
}

.logs-container .modern-table td {
    font-size: 0.9rem;
}

.error-log {
    background-color: rgba(231, 76, 60, 0.2) !important;
}

.alert {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    color: white;
}

.alert.error {
    background-color: #E74C3C;
}

.alert.success {
    background-color: #2ECC71;
}

/* Animations */
@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

.stat-card, .expiring-card {
    animation: fadeIn 0.5s ease-out forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Responsive Adjustments */
@media only screen and (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }
    .sidebar {
        left: -250px;
    }
    .sidebar.open {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .credits-display {
        top: 15px;
        left: 50px;
        right: auto;
        font-size: 14px;
        padding: 5px 10px;
        z-index: 900;
    }
    .sidebar.open ~ .credits-display {
        z-index: 100;
    }
    .sidebar-logo {
        max-width: 60%;
        transform: translateX(-20px);
    }
    .stat-card {
        max-width: 100%;
    }
    .search-card {
        margin: 10px 5px;
        flex-direction: column;
        align-items: stretch;
    }
    .search-card form {
        flex-direction: column;
        gap: 5px;
    }
    .modern-table {
        margin: 10px 0;
    }
    .sidebar .close-btn {
        display: block;
    }
    .modern-table th, .modern-table td {
        padding: 8px;
        font-size: 0.9rem;
    }
    .modern-table th:nth-child(1), .modern-table td:nth-child(1) { width: auto; }
    .modern-table th:nth-child(2), .modern-table td:nth-child(2) { width: auto; }
    .modern-table th:nth-child(3), .modern-table td:nth-child(3) { width: auto; text-align: center; }
    .modern-table th:nth-child(4), .modern-table td:nth-child(4) { width: auto; text-align: center; }
    .modern-table th:nth-child(5), .modern-table td:nth-child(5) { width: auto; }
    .modern-table th:nth-child(6), .modern-table td:nth-child(6) { width: auto; text-align: center; }
    .modern-table th:nth-child(7), .modern-table td:nth-child(7) { width: auto; }
    .modern-table th:nth-child(8), .modern-table td:nth-child(8) { width: auto; }
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

@media only screen and (min-width: 769px) {
    .sidebar {
        left: 0;
    }
    .main-content {
        margin-left: 250px;
    }
    .mobile-topbar {
        display: none;
    }
    .sidebar-toggle {
        display: none;
    }
    .sidebar .close-btn {
        display: none;
    }
}