/* CSS Custom Properties - Shogun World Theme */
:root {
    --primary-color: #1a83cc; /* Blue Grotto */
    --primary-dark: #00478f; /* Midnight Blue */
    --secondary-color: #cbebf5; /* Baby Blue */
    --accent-color: #65dff6; /* Tiffany Blue */
    --text-primary: #00478f; /* Midnight Blue for primary text */
    --text-secondary: #1a83cc; /* Blue Grotto for secondary text */
    --text-light: #65dff6; /* Tiffany Blue for light text */
    --background: #ffffff;
    --surface: #f8fafc;
    --border: #cbebf5; /* Baby Blue for borders */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--surface) 0%, var(--background) 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: 1000;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    padding: 2rem 0;
    text-align: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: 3rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.back-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: var(--transition);
    font-weight: 500;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) translateX(-2px);
}

.app-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-subtitle {
    font-size: 1.125rem;
    font-weight: 400;
    opacity: 0.9;
    margin: 0;
}

/* Main Content */
.app-main {
    flex: 1;
    padding: 0 0 3rem 0;
}

/* Chess App Container */
#chess-app {
    max-width: 1000px;
    margin: 0 auto;
}

/* React Component Styles */
.chess-simulator {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.simulator-header {
    text-align: center;
    margin-bottom: 2rem;
}

.simulator-title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    position: relative;
}

.simulator-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 3rem;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

.openings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.opening-section {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.opening-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.opening-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-transform: capitalize;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.opening-section h3::before {
    content: '';
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 2rem;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 1px;
}

/* Add move notation styling for first move headers */
.opening-section h3::after {
    content: attr(data-move);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    background: var(--secondary-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-left: auto;
}

.opening-subsection {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.opening-subsection:last-child {
    margin-bottom: 0;
}

.opening-subsection h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.opening-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.opening-button {
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
}

.opening-button:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.opening-button:active {
    transform: translateY(0);
}

.simulator-workspace {
    background: var(--background);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-top: 2rem;
}

.opening-info {
    text-align: center;
    margin-bottom: 2rem;
}

.opening-name {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.opening-explanation {
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.control-button {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.control-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.control-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.control-button:active:not(:disabled) {
    transform: translateY(0);
}

.chess-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.move-info {
    text-align: center;
    margin-bottom: 1rem;
}

.current-move {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.move-number {
    font-weight: 600;
    color: var(--primary-color);
}

.move-text {
    font-weight: 500;
    color: var(--text-secondary);
}

.move-line {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.8;
    word-break: break-all;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Chessboard Customization */
.chessboard {
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0 0.5rem;
    }
    
    .app-header {
        padding: 1.5rem 0;
        margin-bottom: 2rem;
    }
    
    .back-link {
        position: static;
        transform: none;
        margin-bottom: 1rem;
        align-self: flex-start;
    }
    
    .header-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .openings-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .opening-section {
        padding: 1rem;
    }
    
    .simulator-workspace {
        padding: 1.5rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-button {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .app-header {
        padding: 1rem 0;
    }
    
    .opening-buttons {
        flex-direction: column;
    }
    
    .opening-button {
        width: 100%;
        text-align: center;
    }
    
    .chess-board-container {
        margin: 0 -1rem 2rem -1rem;
    }
    
    .chessboard {
        border-radius: 0;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --border: #334155;
    }
    
    .chessboard {
        filter: invert(0.9) hue-rotate(180deg);
    }
}

/* Focus styles for accessibility */
.opening-button:focus,
.control-button:focus,
.back-link:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Animation for opening selection */
.opening-button.selected {
    background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
    transform: scale(1.05);
}

/* Loading states */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 