/* ===================================
   ROOT VARIABLES (from Next.js globals.css)
   =================================== */
:root {
    /* Colors - Light Mode */
    --background: oklch(0.98 0.01 280);
    --foreground: oklch(0.25 0.02 280);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.25 0.02 280);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.25 0.02 280);
    --primary: oklch(0.55 0.18 280);
    --primary-foreground: oklch(0.99 0 0);
    --secondary: oklch(0.92 0.02 280);
    --secondary-foreground: oklch(0.25 0.02 280);
    --muted: oklch(0.95 0.01 280);
    --muted-foreground: oklch(0.5 0.02 280);
    --accent: oklch(0.65 0.2 320);
    --accent-foreground: oklch(0.99 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.99 0 0);
    --border: oklch(0.88 0.02 280);
    --input: oklch(0.88 0.02 280);
    --ring: oklch(0.55 0.18 280);
    --radius: 0.75rem;
    
    /* Fonts */
    --font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    :root {
        --background: oklch(0.09 0.01 264);
        --foreground: oklch(0.98 0.005 264);
        --card: oklch(0.13 0.015 264);
        --card-foreground: oklch(0.98 0.005 264);
        --popover: oklch(0.11 0.012 264);
        --popover-foreground: oklch(0.98 0.005 264);
        --primary: oklch(0.65 0.25 264);
        --primary-foreground: oklch(0.98 0.005 264);
        --secondary: oklch(0.18 0.02 264);
        --secondary-foreground: oklch(0.98 0.005 264);
        --muted: oklch(0.18 0.02 264);
        --muted-foreground: oklch(0.65 0.015 264);
        --accent: oklch(0.55 0.22 300);
        --accent-foreground: oklch(0.98 0.005 264);
        --destructive: oklch(0.55 0.25 25);
        --destructive-foreground: oklch(0.98 0.005 264);
        --border: oklch(0.22 0.02 264);
        --input: oklch(0.22 0.02 264);
        --ring: oklch(0.65 0.25 264);
    }
}

/* ===================================
   RESET & BASE STYLES
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.min-h-screen {
    min-height: 100vh;
}

/* ===================================
   ENTRY SCREEN STYLES
   =================================== */
.entry-screen-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--background) 0%, var(--background) 50%, color-mix(in oklch, var(--primary) 10%, transparent) 100%);
    animation: fadeIn 0.7s ease-out;
}

/* Entry Card */
.entry-card {
    position: relative;
    width: 100%;
    max-width: 32rem;
    background: color-mix(in oklch, var(--card) 80%, transparent);
    backdrop-filter: blur(12px);
    border: 2px solid color-mix(in oklch, var(--border) 50%, transparent);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: zoomIn 0.5s ease-out, slideUp 0.5s ease-out;
    transition: all 0.3s ease;
}

.entry-card:hover {
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.35);
    border-color: color-mix(in oklch, var(--primary) 30%, transparent);
}

/* Gradient Overlay */
.card-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in oklch, var(--primary) 5%, transparent) 0%, transparent 50%, color-mix(in oklch, var(--accent) 5%, transparent) 100%);
    pointer-events: none;
}

/* Card Header */
.entry-card-header {
    text-align: center;
    padding: 3rem 2.5rem 2.5rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Icon Container */
.icon-container {
    margin: 0 auto;
    width: 7rem;
    height: 7rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, color-mix(in oklch, var(--primary) 20%, transparent) 0%, color-mix(in oklch, var(--accent) 20%, transparent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 2px solid color-mix(in oklch, var(--primary) 30%, transparent);
    transition: all 0.3s ease;
    animation: slideDown 0.5s ease-out 0.1s both;
}

.icon-container:hover {
    transform: scale(1.05);
    border-color: color-mix(in oklch, var(--primary) 50%, transparent);
}

.icon-svg {
    width: 3.5rem;
    height: 3.5rem;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.icon-container:hover .icon-svg {
    transform: scale(1.1);
}

/* Title */
.entry-title {
    font-size: 3rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--foreground) 0%, color-mix(in oklch, var(--foreground) 70%, transparent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    animation: slideDown 0.5s ease-out 0.2s both;
}

/* Card Content */
.entry-card-content {
    padding: 0 2.5rem 3rem;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: slideUp 0.5s ease-out 0.3s both;
}

.input-label {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.label-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--primary);
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
}

.name-input {
    width: 100%;
    height: 3.5rem;
    font-size: 1.25rem;
    padding: 0 1rem;
    border: 2px solid color-mix(in oklch, var(--border) 60%, transparent);
    border-radius: 0.75rem;
    background: color-mix(in oklch, var(--background) 50%, transparent);
    color: var(--foreground);
    font-family: var(--font-family);
    transition: all 0.2s ease;
    outline: none;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.name-input:hover {
    border-color: var(--border);
}

.name-input:focus {
    transform: scale(1.01);
    border-color: color-mix(in oklch, var(--primary) 50%, transparent);
    background: var(--background);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.name-input::placeholder {
    color: var(--muted-foreground);
    font-size: 1rem;
    opacity: 0.7;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: color-mix(in oklch, var(--muted-foreground) 40%, transparent);
    transition: color 0.2s ease;
    pointer-events: none;
}

.name-input:focus + .input-icon {
    color: color-mix(in oklch, var(--primary) 40%, transparent);
}

.input-icon-svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Button Section */
.button-section {
    animation: slideUp 0.5s ease-out 0.4s both;
}

.start-button {
    width: 100%;
    height: 4rem;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-family);
    color: var(--primary-foreground);
    background: var(--primary);
    border: none;
    border-radius: 0.75rem;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px color-mix(in oklch, var(--primary) 20%, transparent);
    transition: all 0.3s ease;
    outline: none;
}

.start-button:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px color-mix(in oklch, var(--primary) 40%, transparent);
}

.start-button:active {
    transform: scale(0.98);
}

.start-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===================================
   LOADING STATE
   =================================== */
.loading-state {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
    z-index: 9999;
}

.loading-state.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.spinner-large {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 1.125rem;
    color: var(--muted-foreground);
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 24rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-color: #10b981;
    background: color-mix(in oklch, #10b981 10%, var(--card));
}

.toast.error {
    border-color: var(--destructive);
    background: color-mix(in oklch, var(--destructive) 10%, var(--card));
}

.toast-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.toast-description {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-2rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 640px) {
    .entry-title {
        font-size: 2.25rem;
    }
    
    .icon-container {
        width: 5.5rem;
        height: 5.5rem;
    }
    
    .icon-svg {
        width: 2.75rem;
        height: 2.75rem;
    }
    
    .entry-card-header {
        padding: 2rem 1.5rem 1.5rem;
    }
    
    .entry-card-content {
        padding: 0 1.5rem 2rem;
    }
    
    .name-input {
        font-size: 1rem;
    }
    
    .input-label {
        font-size: 1.125rem;
    }
    
    .start-button {
        font-size: 1.125rem;
        height: 3.5rem;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.rtl {
    direction: rtl;
}

.ltr {
    direction: ltr;
}

/* ===== Game Header ===== */
.game-header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-info {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-item .label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.info-item .value {
    color: var(--text);
    font-weight: 700;
    font-size: 1rem;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.phase-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
}

.leave-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: color-mix(in oklch, var(--destructive) 10%, transparent);
    color: var(--destructive);
    border: 1px solid color-mix(in oklch, var(--destructive) 30%, transparent);
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.leave-btn:hover {
    background: color-mix(in oklch, var(--destructive) 20%, transparent);
    border-color: var(--destructive);
}

.leave-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.game-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 5rem);
}

.phase-container {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .game-header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .header-info {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .info-item {
        width: 100%;
        justify-content: space-between;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .game-container {
        padding: 1rem;
    }
    
    .phase-container {
        padding: 1rem;
    }
}