/**
 * css/core/components.css
 * Reusable components: Glass Card, Buttons, Forms, Tabs, Badges,
 * Upload Zone, File Preview, Modals, Transcript Messages, Spinner,
 * Notification Toast, Cookie Banner
 */

/* =============================================================================
   GLASS CARD
   ============================================================================= */
.glass-card {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: var(--transition-base);
}

.glass-card:hover {
    border-color: var(--border-glow);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

a.btn-primary,
a.btn-primary:hover,
a.btn-primary:visited {
    color: white;
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-tertiary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--error);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: var(--error-light);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px dashed var(--border-color);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gradient-subtle);
    border-color: var(--primary);
    border-style: solid;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-glow {
    animation: btn-glow 3s ease-in-out infinite;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* =============================================================================
   FORMS & INPUTS
   ============================================================================= */

/* Shared visual base for styled form controls */
.input,
textarea,
select {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 400;
    transition: var(--transition-base);
}

.input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-primary-focus);
}

/* Text inputs */
.input {
    padding: 0.75rem 1rem;
    width: 100%;
}

.input-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Textareas */
textarea {
    width: 100%;
    min-height: 160px;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: none;
}

textarea::placeholder {
    color: var(--text-muted);
}

/* Selects */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

/* Checkboxes */
.checkbox {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
}

.checkbox input {
    display: none;
}

.checkbox-mark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.checkbox input:checked + .checkbox-mark {
    background: var(--gradient-primary);
    border-color: transparent;
}

.checkbox input:checked + .checkbox-mark::after {
    content: '\2713';
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
}

/* =============================================================================
   TABS
   ============================================================================= */
.tabs {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
    justify-content: center;
    background: var(--bg-tertiary);
    padding: 0.25rem;
    border-radius: var(--radius-full);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.tab {
    padding: 0.625rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition-base);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-secondary);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-panel.active {
    display: block;
}

/* =============================================================================
   BADGES
   ============================================================================= */
.optional-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.75rem;
    user-select: none;
    -webkit-user-select: none;
}

.step-header-with-badge {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.step-header-with-badge h3 {
    margin-bottom: 0;
}

/* =============================================================================
   UPLOAD ZONE
   ============================================================================= */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    cursor: pointer;
    transition: var(--transition-base);
    background: var(--bg-secondary);
    position: relative;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--gradient-subtle);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

.upload-zone-icon {
    font-size: 2.5rem;
    transition: var(--transition-base);
}

.upload-zone:hover .upload-zone-icon {
    transform: scale(1.1) translateY(-4px);
}

.upload-zone-text {
    font-weight: 600;
    color: var(--text-primary);
}

.upload-zone-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.upload-zone-formats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 0.5rem;
}

.upload-zone-formats span {
    padding: 0.25rem 0.625rem;
    background: var(--gradient-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* =============================================================================
   FILE PREVIEW
   ============================================================================= */
.file-preview {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--gradient-subtle);
    border-radius: var(--radius-md);
    text-align: left;
}

.file-preview-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    gap: 0.5rem;
}

.file-preview-info {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    flex: 1;
}

.file-preview-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.file-preview-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.file-preview-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.file-preview-remove:hover {
    background: var(--error-bg);
    transform: scale(1.1);
}

.result-box {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--success-bg);
    border: 1px solid var(--success);
    border-radius: var(--radius-md);
    text-align: left;
    color: var(--text-primary);
}

.result-box strong {
    color: var(--success);
}

/* =============================================================================
   MODALS
   ============================================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
}

.modal-overlay.active {
    display: block;
}

.modal-overlay.loading-active {
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: none;
    text-align: center;
    min-width: 320px;
    max-width: calc(100vw - 2rem);
    box-shadow: var(--shadow-lg);
    cursor: default;
    border: 1px solid var(--border-light);
}

.modal.active {
    display: block;
    animation: modalIn 0.3s ease-out;
}

.modal .spinner {
    margin: 0 auto 1rem;
}

#loading-modal {
    user-select: none;
    -webkit-user-select: none;
}

.modal p {
    text-align: center;
    margin: 0;
    color: var(--text-primary);
}

.modal-lg,
.modal-md {
    max-height: 85vh;
    padding: 0;
    display: none;
    flex-direction: column;
}

.modal-lg.active,
.modal-md.active {
    display: flex;
}

.modal-lg {
    min-width: 640px;
    max-width: 90vw;
}

.modal-md {
    min-width: 420px;
    max-width: 520px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-tertiary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--error-bg);
    color: var(--error);
}

.modal-body-wrapper {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* =============================================================================
   TRANSCRIPT MESSAGES (Modal & Share)
   ============================================================================= */
.transcript-message {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    max-width: 85%;
    width: fit-content;
    text-align: left;
    cursor: text;
}

.transcript-message.interviewer {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    margin-right: auto;
    margin-left: 0;
}

.transcript-message.candidate {
    background: var(--gradient-primary);
    color: white;
    margin-left: auto;
    margin-right: 0;
}

.transcript-message .message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.transcript-message.interviewer .message-sender {
    color: rgba(148, 163, 184, 0.9);
}

.transcript-message.candidate .message-sender {
    color: rgba(255, 255, 255, 0.8);
}

.transcript-message .message-content {
    line-height: 1.6;
    text-align: left;
}

/* =============================================================================
   SPINNER
   ============================================================================= */
.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

/* =============================================================================
   NOTIFICATION TOAST
   ============================================================================= */
.notification-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: calc(100vw - 2rem);
    text-align: center;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}

.notification-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification-toast.notification-info    { border-left: 4px solid var(--primary); }
.notification-toast.notification-warning { border-left: 4px solid var(--primary-light); }
.notification-toast.notification-error   { border-left: 4px solid var(--error); }
.notification-toast.notification-success { border-left: 4px solid var(--success); }

/* =============================================================================
   COOKIE BANNER
   ============================================================================= */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    padding: 1.25rem 1.5rem;
    z-index: 1000;
    display: none;
    animation: slideUp 0.4s ease-out;
}

.cookie-banner.active {
    display: block;
}

.cookie-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cookie-text {
    flex: 1;
    min-width: 250px;
}

.cookie-text h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.375rem;
    color: var(--text-primary);
}

.cookie-text p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.cookie-text a {
    color: var(--primary);
    text-decoration: none;
}

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

.cookie-actions {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}