/* shadcn/ui inspired design system */

:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
}

.dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    border-bottom: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
}

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

.logo-icon {
    color: hsl(var(--primary));
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Two Column Layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

/* Card */
.card {
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) + 4px);
    padding: 2rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.left-column {
    position: sticky;
    top: 2rem;
}

.right-column {
    min-height: 600px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow content to shrink */
    overflow: hidden; /* Prevent content overflow */
}

/* Tabs */
.tabs-container {
    width: 100%;
}

.tabs-list {
    display: inline-flex;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background-color: hsl(var(--muted));
    padding: 0.25rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 1.5rem;
}

.tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: calc(var(--radius) - 2px);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.tab:hover {
    background-color: hsl(var(--background) / 0.5);
}

.tab.active {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.tab-icon {
    width: 1rem;
    height: 1rem;
}

.tab-content {
    display: none;
    padding: 1rem 0;
}

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

/* Upload Area */
.upload-area {
    border: 2px dashed hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--accent) / 0.5);
}

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

.upload-icon-wrapper {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: hsl(var(--muted));
}

.upload-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: hsl(var(--muted-foreground));
}

.upload-text {
    max-width: 28rem;
}

.upload-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.upload-subtitle {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.file-info {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--primary));
}

/* Record Area */
.record-area {
    padding: 2rem 1.5rem;
}

.record-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.record-icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: hsl(var(--muted));
    transition: all 0.3s;
}

.record-icon-wrapper.recording {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background-color: hsl(var(--destructive) / 0.2);
}

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

.record-icon {
    width: 1.75rem;
    height: 1.75rem;
    color: hsl(var(--muted-foreground));
}

.record-icon-wrapper.recording .record-icon {
    color: hsl(var(--destructive));
}

.record-status {
    text-align: center;
    color: hsl(var(--muted-foreground));
}

/* Options */
.options-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.label-icon {
    width: 1rem;
    height: 1rem;
}

.form-select,
.form-input {
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
    color: hsl(var(--foreground));
}

.form-select:focus,
.form-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
    border-color: hsl(var(--ring));
}

.form-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.5rem;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn-icon {
    width: 1rem;
    height: 1rem;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    width: 100%;
    height: 3rem;
    font-size: 1rem;
}

.btn-primary:hover:not(:disabled) {
    background-color: hsl(var(--primary) / 0.9);
}

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

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

.btn-record {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.btn-record:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.btn-record.recording {
    background-color: hsl(var(--destructive));
}

.btn-record.recording:hover {
    background-color: hsl(var(--destructive) / 0.9);
}

.btn-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
}

.btn-ghost:hover {
    background-color: hsl(var(--accent));
}

.btn-sm {
    height: 2rem;
    padding: 0.25rem 0.75rem;
}

/* Progress */
.progress-container {
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background-color: hsl(var(--muted) / 0.5);
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.progress-spinner {
    flex-shrink: 0;
}

.spinner-icon {
    width: 1.5rem;
    height: 1.5rem;
    animation: spin 1s linear infinite;
}

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

.progress-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-title {
    font-size: 0.875rem;
    font-weight: 500;
}

.progress-percentage {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    font-weight: 600;
}

.progress-bar {
    height: 0.5rem;
    width: 100%;
    overflow: hidden;
    border-radius: 9999px;
    background-color: hsl(var(--secondary));
}

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

/* Results */
.result-container {
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid hsl(var(--border));
    background-color: hsl(var(--muted) / 0.3);
}

.result-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(142.1 76.2% 36.3%);
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
}

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

.result-content {
    padding: 1rem;
    background-color: hsl(var(--background));
}

.result-text {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background-color: hsl(var(--muted));
    border-radius: var(--radius);
}

/* Result Placeholder */
.result-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.placeholder-content {
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    width: 3rem;
    height: 3rem;
    color: hsl(var(--muted-foreground));
    margin: 0 auto 1rem;
}

.placeholder-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: hsl(var(--foreground));
}

.placeholder-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

/* Alert */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 2rem;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
}

.alert-error {
    background-color: hsl(var(--destructive) / 0.1);
    border-color: hsl(var(--destructive) / 0.3);
}

.alert-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
    color: hsl(var(--destructive));
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: hsl(var(--destructive));
}

.alert-description {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
}

/* Footer */
.footer {
    border-top: 1px solid hsl(var(--border));
    padding: 2rem;
    background-color: hsl(var(--card));
}

.footer-text {
    text-align: center;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.footer-icon {
    width: 1rem;
    height: 1rem;
    color: hsl(0 84.2% 60.2%);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    min-width: 20rem;
    padding: 1rem;
    border-radius: var(--radius);
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    animation: slideIn 0.2s ease-out;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid hsl(142.1 76.2% 36.3%);
}

.toast-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    color: hsl(142.1 76.2% 36.3%);
}

.toast-content {
    font-size: 0.875rem;
    flex: 1;
}

/* Responsive */
@media (max-width: 1024px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .left-column {
        position: static;
    }

    .right-column {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .form-group.full-width {
        grid-column: span 1;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .result-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .toast {
        min-width: auto;
    }
}

/* Passcode Modal */
.passcode-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.passcode-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: hsl(var(--background) / 0.95);
    backdrop-filter: blur(8px);
}

.passcode-content {
    position: relative;
    z-index: 10000;
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.passcode-header {
    text-align: center;
    margin-bottom: 2rem;
}

.passcode-icon {
    width: 3rem;
    height: 3rem;
    color: hsl(var(--primary));
    margin-bottom: 1rem;
}

.passcode-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: hsl(var(--foreground));
    margin-bottom: 0.5rem;
}

.passcode-description {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.passcode-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.passcode-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: hsl(var(--background));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    color: hsl(var(--foreground));
    transition: all 0.2s;
    text-align: center;
    letter-spacing: 0.2em;
}

.passcode-input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
}

.passcode-error {
    padding: 0.75rem;
    background-color: hsl(var(--destructive) / 0.1);
    border: 1px solid hsl(var(--destructive) / 0.3);
    border-radius: var(--radius);
    color: hsl(var(--destructive));
    font-size: 0.875rem;
    text-align: center;
}

.btn-block {
    width: 100%;
}

.passcode-modal.locked {
    pointer-events: none;
}

body.passcode-locked {
    overflow: hidden;
}

body.passcode-locked .container {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* History Section */
.history-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid hsl(var(--border));
    max-height: 500px;
    overflow-y: auto;
}

.history-section::-webkit-scrollbar {
    width: 8px;
}

.history-section::-webkit-scrollbar-track {
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius);
}

.history-section::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.3);
    border-radius: var(--radius);
}

.history-section::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.5);
}

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

.history-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-icon {
    width: 1.25rem;
    height: 1.25rem;
    color: hsl(var(--muted-foreground));
}

.history-title {
    font-size: 1rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    padding: 1rem;
    background-color: hsl(var(--muted) / 0.3);
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    transition: all 0.2s;
    cursor: pointer;
    max-width: 100%;
    overflow: hidden;
}

.history-item:hover {
    background-color: hsl(var(--muted) / 0.5);
    border-color: hsl(var(--primary) / 0.3);
}

.history-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-date {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-bottom: 0.25rem;
}

.history-item-filename {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.history-item-preview {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.history-empty {
    text-align: center;
    padding: 2rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}
