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

:root {
    --bg-gradient: linear-gradient(135deg, #0f0c1b 0%, #15102a 50%, #06020f 100%);
    --card-bg: rgba(22, 17, 43, 0.45);
    --card-border: rgba(255, 255, 255, 0.07);
    --text-primary: #f3f0ff;
    --text-secondary: #9f9cb6;
    
    /* Accents */
    --accent-purple: #7c4dff;
    --accent-purple-glow: rgba(124, 77, 255, 0.4);
    --accent-blue: #00e5ff;
    --accent-blue-glow: rgba(0, 229, 255, 0.3);
    
    /* Status Colors */
    --status-active: #00e676;
    --status-active-bg: rgba(0, 230, 118, 0.15);
    --status-warning: #ffd600;
    --status-warning-bg: rgba(253, 216, 53, 0.15);
    --status-expired: #ff1744;
    --status-expired-bg: rgba(255, 23, 68, 0.15);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Glowing Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.3;
}
.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-purple);
    top: -100px;
    left: -100px;
}
.orb-2 {
    width: 350px;
    height: 350px;
    background: var(--accent-blue);
    bottom: -50px;
    right: -50px;
}

/* Auth Container styling */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    width: 100%;
}

.auth-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 40px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.8s ease-out;
}

.logo-wrapper {
    text-align: center;
    margin-bottom: 30px;
}

.logo-wrapper h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(to right, #ffffff, #c7a4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-wrapper p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 5px;
}

/* Input Fields styling */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--accent-purple-glow);
    background: rgba(255, 255, 255, 0.08);
}

/* Buttons styling */
.btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-purple) 0%, #512da8 100%);
    border: none;
    border-radius: 12px;
    padding: 14px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(124, 77, 255, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(124, 77, 255, 0.5);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
}

/* Dashboard Styling */
.dashboard-container {
    display: none; /* Show after login */
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeIn 0.8s ease-out;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--card-border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    background: transparent;
    border: 1px solid var(--status-expired);
    color: var(--status-expired);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--status-expired);
    color: white;
    box-shadow: 0 0 15px rgba(255, 23, 68, 0.3);
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.15);
}

.stat-title {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
}

.stat-card.total .stat-value { color: white; }
.stat-card.active .stat-value { color: var(--status-active); }
.stat-card.warning .stat-value { color: var(--status-warning); }
.stat-card.expired .stat-value { color: var(--status-expired); }

/* Charts Layout */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    height: 320px;
    display: flex;
    flex-direction: column;
}

.chart-card h3 {
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.chart-wrapper {
    position: relative;
    flex-grow: 1;
    height: 80%;
}

/* Grid layout for Main Form and Table */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

.form-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    height: fit-content;
}

.form-card h3 {
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Data Table and List styling */
.list-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.list-header h3 {
    font-weight: 600;
    font-size: 1.1rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--card-border);
}

td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.95rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.badge.active {
    background: var(--status-active-bg);
    color: var(--status-active);
}

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

.badge.expired {
    background: var(--status-expired-bg);
    color: var(--status-expired);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    color: white;
}

.action-btn.renew {
    background: rgba(0, 229, 255, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(0, 229, 255, 0.3);
}

.action-btn.renew:hover {
    background: var(--accent-blue);
    color: #0f0c1b;
}

.action-btn.edit {
    background: rgba(255, 214, 0, 0.15);
    color: var(--status-warning);
    border: 1px solid rgba(255, 214, 0, 0.3);
}

.action-btn.edit:hover {
    background: var(--status-warning);
    color: #0f0c1b;
}

.action-btn.delete {
    background: rgba(255, 23, 68, 0.15);
    color: var(--status-expired);
    border: 1px solid rgba(255, 23, 68, 0.3);
}

.action-btn.delete:hover {
    background: var(--status-expired);
    color: white;
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(15, 12, 27, 0.95);
    border: 1px solid var(--accent-purple);
    box-shadow: 0 10px 30px rgba(124, 77, 255, 0.25);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    z-index: 1000;
    display: none;
    animation: slideUp 0.3s ease-out;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(15, 12, 27, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Custom Select Dropdown */
.custom-select {
    position: relative;
    user-select: none;
    cursor: pointer;
}

.custom-select-trigger {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    position: relative;
    transition: var(--transition);
}

.custom-select-trigger:after {
    content: "";
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-secondary);
    transition: var(--transition);
}

.custom-select.open .custom-select-trigger {
    border-color: var(--accent-purple);
    box-shadow: 0 0 15px var(--accent-purple-glow);
    background: rgba(255, 255, 255, 0.08);
}

.custom-select.open .custom-select-trigger:after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: #16112b;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.custom-select.open .custom-select-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-select-option {
    padding: 12px 16px;
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-select-option:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-blue);
}

.custom-select-option.manual-option {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-style: italic;
    color: var(--text-secondary);
}

.custom-select-option.manual-option:hover {
    color: var(--status-warning);
}

.delete-cat-btn {
    color: var(--status-expired);
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0 5px;
    transition: var(--transition);
    cursor: pointer;
}

.delete-cat-btn:hover {
    color: #ff5252;
    transform: scale(1.2);
}

/* Modal Backdrop & Card */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(6, 2, 15, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-backdrop.open {
    display: flex;
}

.modal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 30px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(to right, #ffffff, #c7a4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}


