/* Root Variables */
:root {
    --primary-color: #DC143C;
    --primary-dark: #8B0000;
    --primary-light: #B91C3C;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: #dee2e6;
    --shadow-color: rgba(0, 0, 0, 0.15);
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
}

/* High Contrast Mode */
body.high-contrast {
    --primary-color: #ff0000;
    --primary-dark: #000000;
    --primary-light: #ff3333;
    --text-primary: #000000;
    --text-secondary: #000000;
    --bg-primary: #ffffff;
    --bg-secondary: #ffffff;
    --border-color: #000000;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

body.high-contrast * {
    font-weight: 600 !important;
}

body.high-contrast .form-control,
body.high-contrast .form-select {
    border-width: 2px;
    border-color: #000000;
}

body.high-contrast .card {
    border: 3px solid #000000;
}

body.high-contrast .badge {
    border: 2px solid #000000;
}

/* Contrast Toggle Button */
.contrast-toggle {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1100;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--shadow-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.contrast-toggle:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px var(--shadow-color);
}

.contrast-toggle i {
    font-size: 1.5rem;
}

/* Main Styles */
.gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    padding: 2rem 0;
    position: relative;
}

.gradient-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.05)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.form-container {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 25px 50px var(--shadow-color);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

/* Skills */
.skill-badge {
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    user-select: none;
}

.skill-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.2);
    border-color: var(--primary-color);
}

.skill-badge.selected {
    background-color: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color);
}

/* Form Controls */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(220, 20, 60, 0.25);
}

/* Headers */
.header-icon {
    font-size: 3.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-shadow: 0 4px 8px rgba(220, 20, 60, 0.2);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 20, 60, 0.3);
}

/* Cards */
.card-header.bg-primary,
.card-header.bg-success,
.card-header.bg-info {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Registration Type */
.registration-type {
    background: linear-gradient(45deg, rgba(220, 20, 60, 0.05), rgba(220, 20, 60, 0.1));
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.registration-type:hover {
    background: linear-gradient(45deg, rgba(220, 20, 60, 0.1), rgba(220, 20, 60, 0.15));
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(220, 20, 60, 0.2);
}

.registration-type.selected {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
}

.registration-type.selected h5,
.registration-type.selected p {
    color: white !important;
}

.company-fields {
    display: none;
}

/* Tables */
.table-borderless td {
    border: none;
    padding: 0.75rem 0.5rem;
    vertical-align: middle;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

/* Focus States */
.focused {
    background: rgba(220, 20, 60, 0.02);
    border-radius: 6px;
    transition: all 0.3s ease;
}

/* Animations */
.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* AI Overview & SGE Optimization Styles */
[data-ai-content="heading"] {
    scroll-margin-top: 2rem;
}

[data-ai-content="description"] {
    line-height: 1.6;
    margin-bottom: 1rem;
}

[data-ai-content="technology"] {
    transition: all 0.2s ease;
}

.ai-summary {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.05), rgba(220, 20, 60, 0.1));
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 8px 8px 0;
}

.tech-highlight {
    background: rgba(220, 20, 60, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

.tech-focus-info {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.03), rgba(220, 20, 60, 0.06));
    border: 1px solid rgba(220, 20, 60, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.tech-focus-info i {
    color: var(--primary-color);
}

/* PWA-specific styles */
@media (display-mode: standalone) {
    .pwa-only {
        display: block !important;
    }

    .browser-only {
        display: none !important;
    }

    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

@media (display-mode: browser) {
    .pwa-only {
        display: none !important;
    }
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: var(--danger-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    z-index: 1050;
    display: none;
}

.offline-indicator.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .contrast-toggle {
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .contrast-toggle i {
        font-size: 1.25rem;
    }

    .table-responsive table,
    .table-responsive tbody,
    .table-responsive tr,
    .table-responsive td {
        display: block;
        width: 100%;
    }

    .table-responsive tr {
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 1rem;
        padding: 1rem;
        background: var(--bg-secondary);
    }

    .table-responsive td:first-child {
        font-weight: 600;
        color: var(--primary-color);
        margin-bottom: 0.5rem;
    }

    .table-responsive td {
        padding: 0.25rem 0;
        border: none;
    }
}

/* Focus Visible */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Success Message */
#successMessage .bi-check-circle {
    font-size: 3rem;
}

/* Tech Info Footer */
.tech-info {
    background: var(--bg-secondary);
}

/* Accessibility Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}