/* ==========================================================================
   AI Interview Agent - Main Stylesheet
   ========================================================================== */

/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --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);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

/* Hidden attribute support */
[hidden] {
    display: none !important;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-background);
    margin: 0 -20px;
    padding: 20px 40px;
    margin-bottom: 30px;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.nav-link {
    padding: 10px 16px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
    white-space: nowrap;
    text-align: center;
}

.nav-link:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.nav .btn {
    white-space: nowrap;
    padding: 10px 16px;
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    padding-bottom: 40px;
}

/* Form Sections */
.form-section {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.section-icon {
    font-size: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

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

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.required {
    color: var(--danger-color);
}

.help-text {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* Input Fields */
input[type="text"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--card-background);
    color: var(--text-primary);
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Tags Input */
.tags-input-container {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    background: var(--card-background);
    transition: var(--transition);
}

.tags-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.tags-container:empty {
    margin-bottom: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    line-height: 1;
    transition: var(--transition);
}

.tag-remove:hover {
    background: var(--primary-hover);
}

.tags-input-container input {
    border: none;
    padding: 4px 0;
    font-size: 1rem;
    outline: none;
    width: 100%;
    background: transparent;
}

.tags-input-container input:focus {
    box-shadow: none;
}

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.file-upload-area:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.file-upload-area.dragover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.file-upload-area.large {
    padding: 50px 30px;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.upload-content p {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-content small {
    color: var(--text-secondary);
}

.file-preview {
    margin-top: 16px;
}

.file-preview:empty {
    display: none;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--radius-md);
    margin-top: 8px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-icon {
    font-size: 1.5rem;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.file-remove {
    padding: 6px 12px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    transition: var(--transition);
}

.file-remove:hover {
    opacity: 0.9;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

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

.btn-primary:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--card-background);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 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: 1000;
    backdrop-filter: blur(4px);
}

.modal[hidden] {
    display: none;
}

.modal-content {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 12px;
    font-size: 1.5rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.success-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
}

/* Report Page Styles */
.report-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.report-card {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.report-card:hover {
    box-shadow: var(--shadow-md);
}

.report-info h3 {
    font-size: 1.125rem;
    margin-bottom: 4px;
}

.report-meta {
    display: flex;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.report-actions {
    display: flex;
    gap: 8px;
}

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

/* Status Badges */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: var(--warning-color);
    color: white;
}

.status-completed {
    background: var(--success-color);
    color: white;
}

.status-failed {
    background: var(--danger-color);
    color: white;
}

/* Report Detail Styles */
.report-detail {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.report-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.report-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.report-header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.report-section {
    margin-bottom: 32px;
}

.report-section h2 {
    font-size: 1.25rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-item {
    padding: 12px 16px;
    background: var(--background-color);
    border-radius: var(--radius-md);
}

.info-item label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

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

/* Score Table */
.score-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.score-table th,
.score-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.score-table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--text-primary);
}

.score-table tr:hover {
    background: var(--background-color);
}

.grade-s { color: var(--primary-color); font-weight: 700; }
.grade-a { color: var(--success-color); font-weight: 700; }
.grade-b { color: var(--warning-color); font-weight: 700; }
.grade-c { color: #f97316; font-weight: 700; }
.grade-d { color: var(--danger-color); font-weight: 700; }

/* Analysis Section */
.analysis-item {
    padding: 16px;
    background: var(--background-color);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

.analysis-item h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.analysis-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.verdict-positive {
    color: var(--success-color);
}

.verdict-negative {
    color: var(--danger-color);
}

/* Strengths & Risks */
.strengths-risks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .strengths-risks {
        grid-template-columns: 1fr;
    }
}

.strength-card,
.risk-card {
    padding: 20px;
    border-radius: var(--radius-md);
}

.strength-card {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
}

.strength-card h4 {
    color: var(--success-color);
    margin-bottom: 12px;
}

.risk-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.risk-card h4 {
    color: var(--danger-color);
    margin-bottom: 12px;
}

.strength-card ul,
.risk-card ul {
    list-style: none;
    padding: 0;
}

.strength-card li,
.risk-card li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
}

.strength-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success-color);
}

.risk-card li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    color: var(--danger-color);
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .btn,
    .nav {
        display: none !important;
    }

    .report-detail {
        box-shadow: none;
        border: none;
        padding: 0;
    }

    .container {
        max-width: 100%;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
        padding: 20px;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-link {
        padding: 8px 14px;
        font-size: 0.85rem;
    }

    .nav .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .report-card {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .report-actions {
        width: 100%;
    }

    .report-actions .btn {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .nav {
        gap: 6px;
    }

    .nav-link {
        padding: 8px 10px;
        font-size: 0.8rem;
    }

    .nav .btn {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
}

/* Logo styles */
.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 50px;
    width: auto;
}

/* Section subtitle */
.section-subtitle {
    margin-left: auto;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Knowledge file container */
.knowledge-file-container {
    position: relative;
}

.saved-file {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: var(--radius-lg);
}

.saved-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.saved-file .file-icon {
    font-size: 1.5rem;
}

.saved-file .file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.saved-file .file-meta {
    font-size: 0.8rem;
    color: var(--success-color);
}

.saved-file-actions {
    display: flex;
    gap: 8px;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
    border: none;
}

.btn-danger:hover {
    opacity: 0.9;
}
