/* =============================================================================
   DNS & Domain Manager - Dark Theme 2025
   Modern, sleek dashboard inspired by Vercel, Linear, and Cloudflare
   ============================================================================= */

/* =============================================================================
   CSS VARIABLES - Dark Theme Color Palette
   ============================================================================= */
:root {
    /* Background Colors */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #1c2128;

    /* Border Colors */
    --border-primary: #30363d;
    --border-focus: #58a6ff;

    /* Text Colors */
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-tertiary: #6e7681;
    --text-body: #c9d1d9;

    /* Accent Colors */
    --accent-blue: #58a6ff;
    --accent-blue-hover: #79c0ff;
    --accent-blue-muted: rgba(88, 166, 255, 0.2);
    --accent-blue-subtle: rgba(88, 166, 255, 0.1);

    /* Status Colors */
    --success: #3fb950;
    --success-bg: rgba(63, 185, 80, 0.15);
    --success-hover: #56d364;

    --error: #f85149;
    --error-bg: rgba(248, 81, 73, 0.15);
    --error-hover: #ff6b6b;

    --warning: #d29922;
    --warning-bg: rgba(210, 153, 34, 0.15);

    --info: #58a6ff;
    --info-bg: rgba(88, 166, 255, 0.1);

    /* Button Colors */
    --btn-primary-bg: #238636;
    --btn-primary-hover: #2ea043;
    --btn-primary-active: #196c2e;
    --btn-primary-text: #ffffff;

    /* Spacing - Compact Version */
    --space-xs: 3px;
    --space-sm: 6px;
    --space-md: 8px;
    --space-lg: 10px;
    --space-xl: 14px;
    --space-2xl: 18px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-focus: 0 0 0 2px var(--accent-blue-muted);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* =============================================================================
   RESET & BASE STYLES
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-body);
    line-height: 1.5;
    padding: var(--space-lg);
    min-height: 100vh;
}

/* =============================================================================
   LAYOUT - CONTAINER
   ============================================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeInUp 0.4s ease-out;
}

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

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
h1 {
    color: var(--text-primary);
    font-size: 26px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

h2 {
    color: var(--text-primary);
    font-size: 17px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-primary);
}

h3 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: var(--space-lg);
    font-weight: 400;
}

.help-text {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
    line-height: 1.5;
}

/* =============================================================================
   TABS - Modern Horizontal Selector
   ============================================================================= */
.tabs {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-primary);
    position: relative;
}

.tab-button {
    background: transparent;
    border: none;
    padding: var(--space-sm) 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-base), border-color var(--transition-base);
    position: relative;
}

.tab-button:hover {
    color: var(--text-body);
}

.tab-button.active {
    color: var(--accent-blue);
    border-bottom-color: var(--accent-blue);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* =============================================================================
   SECTIONS - Card Panels
   ============================================================================= */
.section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base);
}

.section:hover {
    transform: translateY(-1px);
}

/* =============================================================================
   FORMS - Input Groups & Fields
   ============================================================================= */
.form-group {
    margin-bottom: var(--space-md);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-row-2 .form-group {
    margin-bottom: 0;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-row-3 .form-group {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.4;
}

/* Checkbox Styles */
input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-right: var(--space-sm);
    accent-color: var(--accent-blue);
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-xs);
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: normal;
    color: var(--text-body);
    font-size: 14px;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

/* =============================================================================
   BUTTONS - Primary, Secondary, & States
   ============================================================================= */
button {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background var(--transition-base), transform var(--transition-fast);
    position: relative;
    overflow: hidden;
}

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

button:active:not(:disabled) {
    background: var(--btn-primary-active);
    transform: translateY(0);
}

button:disabled {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loading State */
button.is-loading {
    pointer-events: none;
}

button.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid var(--btn-primary-text);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

/* Danger Button */
button.btn-danger {
    background: var(--error);
    color: #ffffff;
}

button.btn-danger:hover:not(:disabled) {
    background: var(--error-hover);
}

button.btn-danger:active:not(:disabled) {
    background: #da3633;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Secondary Button Style */
button.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--text-body);
}

button.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: var(--accent-blue-subtle);
}

/* Small Button */
button.btn-small {
    padding: 5px 12px;
    font-size: 11px;
}

/* =============================================================================
   ALERTS / NOTIFICATIONS - Dark Theme
   ============================================================================= */
.message {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-top: var(--space-md);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    border-left: 3px solid;
    animation: slideIn 0.3s ease-out;
}

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

.message.success {
    background: var(--success-bg);
    color: var(--success);
    border-left-color: var(--success);
}

.message.success::before {
    content: '✓';
    font-weight: bold;
    font-size: 16px;
}

.message.error {
    background: var(--error-bg);
    color: var(--error);
    border-left-color: var(--error);
}

.message.error::before {
    content: '✕';
    font-weight: bold;
    font-size: 16px;
}

.message.info {
    background: var(--info-bg);
    color: var(--info);
    border-left-color: var(--info);
}

.message.info::before {
    content: 'ℹ';
    font-weight: bold;
    font-size: 16px;
}

/* =============================================================================
   TABLES - Dark Theme with Status Badges
   ============================================================================= */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--space-md);
    font-size: 13px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

thead {
    background: var(--bg-elevated);
}

th {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-primary);
}

td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--bg-tertiary);
    color: var(--text-body);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-elevated);
}

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

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

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

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

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

.status-badge.taken {
    background: var(--bg-elevated);
    color: var(--text-tertiary);
    border: 1px solid var(--border-primary);
}

.status-badge.banned {
    background: rgba(248, 81, 73, 0.15);
    color: #f85149;
    border: 1px solid rgba(248, 81, 73, 0.4);
}

/* Hide status column when toggle is enabled */
.hide-status .status-col {
    display: none;
}

/* Price column styling */
.price-col {
    font-weight: 600;
    color: var(--text-primary);
}

/* Expensive domain price highlighting */
.price-expensive {
    color: var(--warning);
    font-weight: 700;
}

/* =============================================================================
   CART SECTION
   ============================================================================= */
.cart-list {
    margin: var(--space-md) 0;
}

.cart-item {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color var(--transition-base);
    font-size: 13px;
}

.cart-item:hover {
    border-color: var(--accent-blue);
}

.cart-item button {
    padding: 4px 10px;
    font-size: 11px;
    background: var(--error);
}

.cart-item button:hover:not(:disabled) {
    background: var(--error-hover);
}

/* =============================================================================
   UTILITY CLASSES
   ============================================================================= */
.hidden {
    display: none !important;
}

/* Non-selectable text (for cart numbering) */
.no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: none;
    opacity: 0.6;
}

/* Section visibility - these are controlled by JS .hidden class */
/* Removed hardcoded display:none - sections use .hidden class now */

/* Compact header in cart count */
.cart-list > p:first-child {
    font-size: 13px;
    margin-bottom: 6px;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */
@media (max-width: 768px) {
    body {
        padding: var(--space-sm);
    }

    h1 {
        font-size: 22px;
    }

    h2 {
        font-size: 16px;
    }

    .form-row,
    .form-row-2,
    .form-row-3 {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .form-row .form-group,
    .form-row-2 .form-group,
    .form-row-3 .form-group {
        margin-bottom: var(--space-sm);
    }

    .tabs {
        gap: var(--space-md);
    }

    .section {
        padding: var(--space-md);
        margin-bottom: var(--space-md);
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: var(--space-xs) var(--space-sm);
    }

    button {
        padding: 7px 14px;
        font-size: 12px;
    }
}

/* =============================================================================
   SCROLLBAR STYLING - Dark Theme
   ============================================================================= */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-primary);
}

/* =============================================================================
   SELECTION STYLING
   ============================================================================= */
::selection {
    background: var(--accent-blue-muted);
    color: var(--text-primary);
}

::-moz-selection {
    background: var(--accent-blue-muted);
    color: var(--text-primary);
}

/* =============================================================================
   COLLAPSIBLE SECTIONS
   ============================================================================= */

.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.collapsible-header:hover {
    color: var(--accent-blue);
}

.collapse-icon {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.collapse-icon.collapsed {
    transform: rotate(-90deg);
}

.collapsible-content {
    transition: opacity 0.3s ease;
    max-height: none;
    opacity: 1;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0;
    margin: 0;
}

/* Domain checkbox list */
.domain-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
}

.domain-checkbox-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
}

.domain-checkbox-list label:hover {
    background: var(--bg-tertiary);
}

/* =============================================================================
   DNSSEC SECTION
   ============================================================================= */

/* DNSSEC steps list */
.dnssec-steps {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dnssec-step {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.dnssec-step .step-icon {
    flex-shrink: 0;
    width: 16px;
    font-weight: bold;
}

.dnssec-step.step-success .step-icon {
    color: var(--success);
}

.dnssec-step.step-error .step-icon {
    color: #f85149;
}

.dnssec-step .step-name {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dnssec-step .step-message {
    color: var(--text-primary);
}

/* Status badges for DNSSEC */
.status-badge.partial {
    background: rgba(227, 179, 65, 0.15);
    color: var(--warning);
    border: 1px solid rgba(227, 179, 65, 0.4);
}

.status-badge.pending {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
    border: 1px solid rgba(88, 166, 255, 0.4);
}

/* Secondary button style */
.secondary-btn {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-primary);
}

.secondary-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}
