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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --error-color: #ef4444;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Assistant', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    direction: rtl;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 30px 0;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
}

.section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

/* Auth Section */
.auth-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.auth-box {
    padding: 25px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
}

.auth-box h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

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

/* Messages */
.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
    display: block;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
    display: block;
}

/* User Info */
.user-info {
    background: var(--bg-color);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info span {
    font-weight: 600;
    color: var(--text-primary);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

/* Books List */
.books-list {
    margin-top: 20px;
}

.book-item {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-color);
}

.book-item:hover {
    border-color: var(--primary-color);
    transform: translateX(-5px);
    box-shadow: var(--shadow);
}

.book-item h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.book-item .meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 8px;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-size: 1.1rem;
}

/* Segments List */
.segments-list {
    margin-top: 20px;
}

.segment-item {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 15px;
    background: var(--bg-color);
    transition: all 0.3s ease;
}

.segment-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.segment-item.expanded {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    background: var(--card-bg);
}

.segment-item h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.segment-item .text-preview {
    color: var(--text-secondary);
    margin: 10px 0;
    font-size: 0.9rem;
    line-height: 1.6;
}

.segment-item .text-section {
    margin-bottom: 10px;
}

.segment-item .nikud-text {
    color: var(--primary-color);
    font-weight: 500;
    direction: rtl;
    text-align: right;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    width: min(600px, 90%);
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
}

.modal .form-group {
    margin-bottom: 15px;
}

.modal textarea {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    resize: vertical;
    font-family: inherit;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.audio-player {
    margin-top: 15px;
    width: 100%;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    color: white;
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 1.2rem;
}

/* Spinner */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

.spinner-large {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .auth-container {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 20px;
    }

    .card {
        padding: 20px;
    }
}

