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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Navbar */
.navbar {
    background-color: #509aca;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    height: 32px;
    width: 33px;
    display: block;
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.navbar h1 a {
    color: white;
    text-decoration: none;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.session-info {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.session-phrase {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Courier New', monospace;
    font-weight: 600;
    user-select: all;
    cursor: text;
    font-size: 0.9rem;
}

.btn-copy {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: background-color 0.2s;
}

.btn-copy:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.copy-feedback {
    display: none;
    font-size: 0.75rem;
    color: white;
    background-color: rgba(16, 185, 129, 0.9);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    animation: fadeOut 2s forwards;
}

.copy-feedback.show {
    display: inline-block;
}

@keyframes fadeOut {
    0%, 50% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #509aca;
    color: white;
}

.btn-primary:hover {
    background-color: #3d7ba3;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

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

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-danger {
    background-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    border-left: 4px solid;
}

.alert-info {
    background-color: #d1ebf5;
    border-color: #509aca;
    color: #2c5f7f;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

/* Hero section */
.hero {
    text-align: center;
    padding: 2rem 0;
}

.hero h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.125rem;
    color: #6b7280;
}

/* Action buttons */
.action-buttons {
    text-align: center;
    margin: 2rem 0;
}

/* Recent uploads */
.recent-uploads {
    margin: 2rem 0;
}

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

.upload-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.upload-header h4 {
    font-size: 1rem;
    font-weight: 600;
}

.upload-details {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.upload-actions {
    display: flex;
    gap: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Upload form */
.upload-form {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

/* Preview page */
.preview-header {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.preview-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    color: #6b7280;
}

.validation-stats {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    border-radius: 0.375rem;
}

.stat-valid {
    background-color: #d1fae5;
}

.stat-warning {
    background-color: #fef3c7;
}

.stat-error {
    background-color: #fee2e2;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Entries table */
.entries-table-container {
    background: white;
    border-radius: 0.5rem;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.entries-table {
    width: 100%;
    border-collapse: collapse;
}

.entries-table th {
    background-color: #f3f4f6;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
}

.entries-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}

.entries-table tr:hover {
    background-color: #f9fafb;
}

.entries-table .actions {
    white-space: nowrap;
}

.entries-table .actions .btn {
    margin-right: 0.375rem;
    margin-bottom: 0.25rem;
    vertical-align: top;
}

.loading-row {
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Edit form */
.edit-form {
    padding: 1rem;
    background-color: #f3f4f6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.edit-form .form-group {
    margin-bottom: 0.75rem;
}

.edit-form input,
.edit-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
}

/* HTMX indicators */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline;
}

/* HTMX row blocking - disable entire row during request */
tr.htmx-request {
    opacity: 0.6;
    pointer-events: none;
    background-color: #f3f4f6;
}

/* Footer */
.footer {
    background-color: #f9fafb;
    padding: 1rem 0;
    margin-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
}

.footer-links {
    margin-top: 0.5rem;
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
}

.footer-links a:hover {
    color: #6b7280;
    text-decoration: underline;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

/* Info section */
.info {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-top: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.info h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.info h3:first-child {
    margin-top: 0;
}

.info ul {
    margin-left: 1.5rem;
}

.info li {
    margin-bottom: 0.5rem;
}

.format-info {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.format-info ul {
    margin-left: 1.5rem;
}

.format-info li {
    margin-bottom: 0.5rem;
}

.preview-actions {
    text-align: center;
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.error {
    color: #dc2626;
}

.example-text {
    color: #059669;
}

/* Full-width table toggle */
body.table-full-width .container {
    max-width: none;
    padding: 20px 40px;
}

.table-width-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    justify-content: flex-end;
}

.table-width-toggle button {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s;
}

.table-width-toggle button:hover {
    background-color: #f3f4f6;
    color: #374151;
    border-color: #9ca3af;
}

.table-width-toggle button.active {
    background-color: #e0f0fb;
    color: #2c6e9e;
    border-color: #509aca;
}
