:root {
    --bg-color: #f8fafc;
    --panel-color: #ffffff;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --accent: #818cf8;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.app-container { width: 100%; max-width: 600px; padding: 20px; text-align: center; }
header h1 { font-size: 2.5rem; margin-bottom: 5px; }
header .highlight { color: var(--primary); }
header p { color: var(--text-light); margin-bottom: 30px; }

.card-panel {
    background: var(--panel-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.upload-box { display: flex; flex-direction: column; align-items: center; gap: 15px; }
#csv-file { display: none; }
.custom-file-upload {
    background: var(--primary);
    color: white;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}
.custom-file-upload:hover { background: var(--primary-hover); }
.format-hint { font-size: 0.85rem; color: var(--text-light); }
.hidden { display: none !important; }

.study-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#reset-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-weight: 600; }

/* --- FIXED 3D FLIP LOGIC --- */
.flashcard-container {
    perspective: 1000px; /* Gives depth to the 3D effect */
    width: 100%;
    height: 300px;
    margin-bottom: 30px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d; /* IMPORTANT: Allows children to exist in 3D space */
}

/* This class is toggled via JavaScript */
.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;         /* Hides the side not facing the user */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.card-front {
    background: var(--panel-color);
    color: var(--text-dark);
    z-index: 2; /* Ensures front is on top initially */
}

.card-back {
    background: var(--accent);
    color: white;
    transform: rotateY(180deg); /* Starts rotated so it's hidden */
}

.label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 15px;
    opacity: 0.6;
}

/* Navigation */
.nav-controls { display: flex; justify-content: center; gap: 15px; }
.nav-controls button {
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}
.nav-controls button:hover { background: #f1f5f9; border-color: var(--primary); }
#flip-btn { background: var(--primary); color: white; border: none; }

/* --- AUTH PAGE STYLES --- */
.auth-body {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 450px;
}

.auth-card {
    background: var(--panel-color);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    text-align: center;
}

.auth-header {
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.input-group input {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-main {
    background: var(--primary);
    color: white;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 10px;
}

.btn-main:hover {
    background: var(--primary-hover);
}

.toggle-text {
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.toggle-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.toggle-text a:hover {
    text-decoration: underline;
}

