/* ==========================================================================
   License Server Dashboard - Modern Premium Theme
   ========================================================================== */

:root {
    --bg-base: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-elevated: #1a2234;
    --bg-surface-hover: #222d44;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(99, 102, 241, 0.6);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --emerald: #10b981;
    --emerald-hover: #059669;
    --emerald-light: rgba(16, 185, 129, 0.12);
    
    --rose: #f43f5e;
    --rose-hover: #e11d48;
    --rose-light: rgba(244, 63, 94, 0.12);
    
    --amber: #f59e0b;
    --amber-light: rgba(245, 158, 11, 0.12);

    --cyan: #06b6d4;
    --cyan-light: rgba(6, 182, 212, 0.12);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.1);
    --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.06) 0px, transparent 50%);
    background-attachment: fixed;
}

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* Container */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

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

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    color: #ffffff;
}

.brand-icon svg {
    width: 26px;
    height: 26px;
}

.brand-title {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-title .badge-pill {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.brand-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.stat-total::before { background: var(--primary); }
.stat-card.stat-active::before { background: var(--emerald); }
.stat-card.stat-suspended::before { background: var(--rose); }

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff;
    margin-top: 0.25rem;
    letter-spacing: -0.03em;
}

/* Action Toolbar */
.toolbar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 440px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.search-icon svg {
    width: 18px;
    height: 18px;
}

.search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.6rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.search-input::placeholder {
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-surface-elevated);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-btn {
    padding: 6px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

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

.filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
}

/* Table Card */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

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

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

table.data-table th {
    padding: 1rem 1.25rem;
    background: var(--bg-surface-elevated);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

table.data-table td {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.9rem;
    color: var(--text-primary);
}

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

table.data-table tbody tr:hover {
    background-color: var(--bg-surface-hover);
}

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

/* Client Identity */
.client-info {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.client-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #a5b4fc;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.client-name {
    font-weight: 600;
    color: #ffffff;
}

.client-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Key Display */
.key-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.35rem 0.75rem;
    font-size: 0.83rem;
    color: #e2e8f0;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}

.copy-btn:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.copy-btn svg {
    width: 15px;
    height: 15px;
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-status.active {
    background: var(--emerald-light);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
}

.badge-status.suspended {
    background: var(--rose-light);
    color: #fb7185;
    border: 1px solid rgba(251, 113, 133, 0.25);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.badge-status.active .status-dot {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

.badge-status.suspended .status-dot {
    background: #f43f5e;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.8; }
}

/* Action Buttons */
.actions-cell {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7073ff 0%, #5d54f0 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-outline-primary {
    background: transparent;
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.btn-outline-primary:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--rose) 0%, #be123c 100%);
    color: #ffffff;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #fb7185 0%, #e11d48 100%);
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.3);
}

.btn-ghost-danger {
    background: transparent;
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-ghost-danger:hover {
    background: var(--rose-light);
    color: #f43f5e;
    border-color: var(--rose);
}

.btn-toggle {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 1.5rem;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 32px;
    height: 32px;
}

.empty-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.empty-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: scaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
}

.form-label span.required {
    color: var(--rose);
}

.form-control {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button .form-control {
    flex: 1;
}

/* Status Select Radio Cards */
.radio-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.radio-card {
    position: relative;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md);
    padding: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: var(--transition);
}

.radio-card input[type="radio"] {
    accent-color: var(--primary);
}

.radio-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.radio-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Toast / Alerts */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 420px;
}

.toast {
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.toast.toast-success {
    border-color: rgba(16, 185, 129, 0.4);
    background: #064e3b;
    color: #ecfdf5;
}

.toast.toast-error {
    border-color: rgba(244, 63, 94, 0.4);
    background: #4c0519;
    color: #fff1f2;
}

.toast-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-content {
    flex: 1;
    font-size: 0.88rem;
}

.toast-close {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 2px;
}

.toast-close:hover {
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
    .toolbar-card {
        flex-direction: column;
        align-items: stretch;
    }
    .search-wrapper {
        max-width: 100%;
    }
}
