/* AdminVi Premium Design System */
:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #22d3ee;
    --error: #ef4444;
    --success: #10b981;
    --border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0f172a);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    margin-top: 2rem;
}

h1, h2, h3 {
    letter-spacing: -0.025em;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: white;
    outline: none;
    transition: border-color 0.2s ease;
}

input:focus {
    border-color: var(--primary);
}

/* Dashboard Specific */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Dashboard Table */
.mailbox-table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 1rem;
}

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

.mailbox-table th {
    font-size: 0.8125rem;
    text-transform: uppercase;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-active, .badge-ready {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Form refinement */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-addon {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-left: none;
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

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

.password-group input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    outline: none;
}

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

.toggle-password svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    pointer-events: none;
}

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

.animate {
    animation: fadeIn 0.4s ease-out forwards;
}

/* Footer / Policy */
.agreement-box {
    margin: 1rem 0;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.agreement-box a {
    color: var(--accent);
    text-decoration: none;
}

/* Mobile Responsiveness & Premium Mobile UX */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        margin-top: 0.5rem;
    }

    .header-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1.25rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--border);
        margin-bottom: 1.5rem;
    }

    .header-actions {
        width: 100%;
        display: flex;
        gap: 0.75rem;
    }

    .header-actions .btn {
        flex: 1;
        padding: 0.875rem;
        font-size: 0.875rem;
    }

    /* Transform Table to Card List */
    .mailbox-table, .mailbox-table thead, .mailbox-table tbody, .mailbox-table th, .mailbox-table td, .mailbox-table tr {
        display: block !important;
    }

    .mailbox-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    .mailbox-table tr {
        background: rgba(15, 23, 42, 0.4);
        border: 1px solid var(--border);
        border-radius: 1rem;
        margin-bottom: 1rem;
        padding: 1rem;
    }

    .mailbox-table td {
        border: none;
        border-bottom: none;
        position: relative;
        padding-left: 50% !important;
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
        text-align: right;
        min-height: 2.5rem;
    }

    .mailbox-table td:before {
        position: absolute;
        top: 0.5rem;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--accent);
        content: attr(data-label);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
    }

    .mailbox-table td .btn {
        width: 100%;
        margin-top: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
        text-align: center;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    .responsive-grid {
        grid-template-columns: 1fr !important;
    }

    .glass {
        padding: 1.25rem !important;
    }

    input, select, textarea, .btn {
        font-size: 1rem; /* Better for mobile zoom */
    }

    /* Webmail Link on Mobile */
    .animate a .stat-label {
        font-size: 1rem !important;
    }
}

/* Info Page Transitions */
.animate { animation: fadeIn 0.4s ease-out backwards; }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.shake { animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

.header-flex { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
@media (max-width: 600px) { .header-flex { flex-direction: column; text-align: center; } }
