/* =================================
   BASE STYLES & CSS VARIABLES
   ================================= */

/* CSS Variables - Global Design System */
:root {
    /* Primary Colors */
    --primary: #1A237E;
    --primary-dark: #0d1456;
    --accent: #00C853;
    
    /* Text Colors */
    --text-dark: #1e293b;
    --text-medium: #64748b;
    --text-light: #94a3b8;
    --text-secondary: #64748b;
    
    /* Background Colors */
    --bg-light: #f8fafc;
    --bg-surface: #ffffff;
    --white: #FFFFFF;
    
    /* Border and Dividers */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    /* Shadows */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 25px rgba(0, 0, 0, 0.1);
    
    /* Border Radius */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-xl: 16px;
    
    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.2s ease;
    
    /* Status Colors */
    --success: #16a34a;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #0ea5e9;
}

/* =================================
   RESET AND BASE STYLES
   ================================= */

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

body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    color: var(--primary);
    margin: 0;
    font-weight: 600;
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

/* =================================
   SHARED LAYOUT COMPONENTS
   ================================= */

/* Flex Layout Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-start {
    display: flex;
    align-items: flex-start;
}

.flex-column {
    display: flex;
    flex-direction: column;
}

/* Icon Containers (Unified) */
.icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.icon-container.small {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
}

.icon-container.medium {
    width: 60px;
    height: 60px;
    font-size: 1.75rem;
}

.icon-container.large {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
}

.icon-container.primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
}

.icon-container.light {
    background-color: #e0f2fe;
    color: var(--primary);
}

/* Card Components (Unified) */
.card-base {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card-base.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.card-base.hover-subtle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-base.clickable {
    cursor: pointer;
}

/* Content Sections */
.content-section {
    padding: 2rem;
}

.content-section.compact {
    padding: 1.5rem;
}

/* Header Components (Unified) */
.section-header {
    margin-bottom: 2rem;
}

.section-header.with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.section-title {
    color: var(--primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.section-title.large {
    font-size: 2rem;
}

.section-subtitle {
    color: var(--text-medium);
    margin: 0;
    font-size: 1.1rem;
}

/* Actions Container */
.actions-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* =================================
   PRACTICE MODE MODAL STYLES
   ================================= */

.practice-mode-modal {
    background: white;
    border-radius: var(--border-radius-xl);
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
}

.mode-cards-modal {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    padding: 0;
}

.mode-card-modal {
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 400px;
}

.mode-card-modal:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.mode-icon-modal {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin: 0 auto 1.5rem auto;
    flex-shrink: 0;
}

.mode-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    text-align: center;
}

.mode-content h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.mode-content p {
    color: var(--text-medium);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.mode-features-modal {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.mode-features-modal li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.mode-features-modal li i {
    color: var(--accent);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.mode-btn-modal {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.mode-btn-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.4);
}

.mode-btn-modal.primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
}

.mode-btn-modal.primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
}

/* Responsive adjustments for modal */
@media (max-width: 768px) {
    .mode-cards-modal {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .mode-card-modal {
        min-height: 350px;
        padding: 1.5rem;
    }
    
    .mode-icon-modal {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .mode-content h4 {
        font-size: 1.25rem;
    }
    
    .practice-mode-modal {
        max-width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .mode-card-modal {
        min-height: 320px;
        padding: 1rem;
    }
    
    .mode-icon-modal {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .mode-content h4 {
        font-size: 1.1rem;
    }
    
    .mode-content p {
        font-size: 0.9rem;
    }
    
    .mode-features-modal li {
        font-size: 0.85rem;
    }
    
    .mode-btn-modal {
        padding: 0.875rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* =================================
   FORM ELEMENTS (Shared)
   ================================= */

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

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

/* Icon positioning inside input groups */
.input-group i {
    position: absolute;
    left: 1rem;
    color: var(--text-medium);
    font-size: 1.1rem;
    z-index: 1;
    pointer-events: none;
}

/* Input field styles */
.input-group input,
.form-group input:not(.mode-btn-modal),
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
    box-sizing: border-box;
}

/* Input focus states */
.input-group input:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.1);
}

/* Invalid input states */
.input-group input.invalid,
.form-group input.invalid {
    border-color: var(--error);
}

/* For inputs without icon (no left padding) */
.form-group input:not(.input-group input) {
    padding: 0.875rem 1rem;
}

/* Center text for verification inputs */
.input-center-text,
input.input-center-text {
    text-align: center !important;
}

/* =================================
   BUTTON SYSTEM (Shared)
   ================================= */

.btn,
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    box-sizing: border-box;
    min-height: 48px;
    white-space: nowrap;
}

.btn:disabled,
.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary,
.action-btn.primary {
    background: linear-gradient(135deg, var(--accent), #00e676);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.3);
}

.btn-primary:hover:not(:disabled),
.action-btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 200, 83, 0.4);
}

.btn-secondary,
.action-btn.secondary {
    background: var(--bg-light);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled),
.action-btn.secondary:hover:not(:disabled) {
    background: var(--border-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-large {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-rounded {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
}

/* =================================
   ALERT SYSTEM (Shared)
   ================================= */

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
    border-left: 4px solid;
}

.alert i {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border-color: var(--error);
}

.alert-success {
    background-color: rgba(22, 163, 74, 0.1);
    color: var(--success);
    border-color: var(--success);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: var(--warning);
}

.alert-info {
    background-color: rgba(14, 165, 233, 0.1);
    color: var(--info);
    border-color: var(--info);
}

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

/* =================================
   GRID SYSTEM (Shared)
   ================================= */

.grid-layout {
    display: grid;
    gap: 1.5rem;
}

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.grid-two-columns {
    grid-template-columns: 1fr 1fr;
}

.grid-three-columns {
    grid-template-columns: repeat(3, 1fr);
}

.grid-responsive {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* =================================
   VALIDATION STYLES (Shared)
   ================================= */

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message,
.form-error,
.error-message,
.validation-error {
    color: var(--error);
    font-size: 0.75rem;
    margin-top: 0.25rem;
    display: block;
    min-height: 1rem;
}

/* Blazor Error Boundary */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNT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iA5My41Mjk1IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* =================================
   UTILITY CLASSES (Shared)
   ================================= */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

/* =================================
   RESPONSIVE DESIGN (Base)
   ================================= */

@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .btn,
    .action-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .btn-large {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }

    .grid-layout {
        gap: 1rem;
    }

    .grid-auto-fit,
    .grid-auto-fill,
    .grid-two-columns,
    .grid-three-columns {
        grid-template-columns: 1fr;
    }

    .section-header.with-actions {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .actions-container {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .input-group input,
    .form-group input {
        padding: 0.625rem 0.75rem 0.625rem 2.25rem;
        font-size: 0.9rem;
    }
    
    .input-group i {
        left: 0.75rem;
        font-size: 1rem;
    }

    .content-section {
        padding: 1rem;
    }

    .icon-container.small {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .icon-container.medium {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .icon-container.large {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
}