:root {
    --primary: #1781e0;
    /* Sky 500 */
    --primary-hover: #0284c7;
    --bg-color: #ebf5ff;
    /* Sky 50 */
    --surface-color: #ffffff;
    --text-main: #0f172a;
    --text-sub: #64748b;
    --border-color: #e0f1ff;
    --accent-blue: #1781e0;
    --radius: 12px;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.app-container,
.app-container * {
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.app-container {
    color: var(--text-main);
    width: 100%;
    max-width: 1200px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 0 auto;
}

/* Header */
.app-header {
    text-align: left;
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.header-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.logo-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.logo-icon {
    background: var(--surface-color);
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    color: var(--accent-blue);
    display: flex;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.05em;
}

.version-tag {
    font-size: 0.8rem;
    background: #e0f1ff;
    color: var(--accent-blue);
    padding: 2px 8px;
    border-radius: 999px;
    vertical-align: middle;
    font-weight: 600;
}

.subtitle {
    color: var(--text-sub);
    font-size: 1.05rem;
}

@media(max-width: 960px){
    .header-content{
        flex-direction: column;
    }
}

/* Layout Grid - Right Sidebar */
.layout-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 850px) {
    .layout-grid {
        display: grid;
        grid-template-columns: 1fr 300px;
        align-items: start;
        gap: 2.5rem;
    }

    .sidebar {
        order: 2;
        position: sticky;
        top: 2rem;
    }

    .main-content {
        order: 1;
    }
}

/* Cards (Sidebar & Main) */
.card {
    background: var(--surface-color);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    /*    border: 1px solid var(--border-color);*/
    overflow: visible;
}

.config-card {
    position: relative;
    z-index: 2;
}

.card-header {
    background: #f0f8ff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-body {
    padding: 1.5rem 0 0 0;
}

/* Sidebar Specifics */
.sidebar-info {
    margin-top: 1.5rem;
    padding: 1.5rem 0 0 0;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
}

.sidebar-info h2 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

/* Info Card & Check list */
.info-card {
    background-color: var(--bg-color);
    border-color: var(--border-color);
    padding: 1.5rem;
}

.info-card h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    border-bottom: 2px dashed var(--border-color);
    padding-bottom: 0.5rem;
}

.heic-check-list {
    list-style: none;
    padding: 0;
}

.heic-check-list li {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    padding-left: 1.75rem;
    position: relative;
    display: flex;
    align-items: center;
}

.heic-check-list li:last-child {
    margin-bottom: 0;
}

.heic-check-list li::before {
    content: '✓';
    color: var(--surface-color);
    background-color: var(--primary);
    position: absolute;
    left: 0;
    top: 4px;
    font-weight: bold;
    font-size: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(23, 129, 224, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

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

.toolbar-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Custom Select in Sidebar - Tweaked */
.heic-select-wrapper {
    position: relative;
    width: 100%;
}

.heic-select-wrapper select {
    display: none;
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: var(--surface-color);
    background-image: none !important;
    margin-top: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
}

.heic-select-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    pointer-events: none;
    color: var(--accent-blue);
    display: flex;
}

.custom-select-trigger {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.custom-select-trigger:hover {
    border-color: var(--accent-blue);
    background: white;
}

.custom-select-trigger .heic-arrow {
    width: 16px;
    height: 16px;
}

.custom-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #ffffff;
    border: 1px solid #dadada;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    overflow: hidden;
}

.custom-select-trigger.open+.custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: #333;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
}

.custom-option:last-child {
    border-bottom: none;
}

.custom-option:hover,
.custom-option.selected {
    background: #1472c9;
    color: #ffffff;
}

/* Upload Area */
.upload-container {
    display: grid;
    gap: 1.5rem;
}

#heicFile {
    display: none;
}

.drop-zone {
    background: white;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-zone:hover {
    border-color: var(--accent-blue);
    background: #f8fbff;
    box-shadow: var(--shadow-soft);
}

.upload-illustration {
    margin-bottom: 1rem;
}

.drop-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.drop-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
}

/* Action Panel (Queue) */
.action-panel {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.count-badge span {
    font-weight: 700;
    color: var(--accent-blue);
}

.link-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

.file-queue {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pending-item {
    background: var(--bg-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 0.3s ease;
}

.pending-remove {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-sub);
}

.pending-remove:hover {
    color: #ef4444;
}

/* Button Variants for JS Generated Content */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-weight: 500;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.file-info {
    margin-bottom: 0.5rem;
    text-align: left;
}

.btn-primary-large {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
    transition: transform 0.1s;
}

.btn-primary-large:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(59, 130, 246, 0.4);
}

.btn-primary-large:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status Bar */
.status-bar {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.status-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.timer {
    color: var(--text-sub);
    font-feature-settings: "tnum";
}

.progress-track {
    height: 6px;
    background: var(--bg-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 3px;
    transition: width 0.2s;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.file-card {
    background: white;
    padding: 0.75rem;
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
    position: relative;
    transition: transform 0.2s;
}

.file-card:hover {
    transform: translateY(-3px);
}

.file-preview {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    background: var(--bg-color);
    margin-bottom: 0.5rem;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 1.5rem;
}

.file-status {
    font-size: 0.75rem;
    color: var(--text-sub);
}

.card-remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-sub);
    transition: all 0.2s;
}

.card-remove-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Results Actions */
.results-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-download-all {
    background: #10b981;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
}

/* Footer FAQ */
.footer-faq {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.faq-item h4 {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.faq-item p {
    font-size: 0.85rem;
    color: var(--text-sub);
}

@media(max-width: 600px) {
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .toolbar-divider {
        display: none;
    }

    .footer-faq {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

.heic-select-wrapper select option {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
    background-color: var(--surface-color);
}

.heic-select-wrapper select option:checked {
    background-color: #f0f9ff;
    color: var(--accent-blue);
}

.heic-select-wrapper select:focus {
    border-color: var(--accent-blue);
    background-color: white;
}
