:root {
    --primary: #179fff;
    --primary-foreground: #ffffff;
    --secondary: #f2faff;
    --secondary-foreground: #105d90;
    --accent: #ff832c;
    --accent-hover: #e56c15;
    --destructive: #fc2f51;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --foreground: #333333;
    --muted: #f7f7f7;
    --muted-foreground: #666666;
    --border: #d3d3d3;
    --radius: 5px;
    --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
}

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

.app-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    padding-bottom: 6rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
    min-height: calc(100vh - 80px);
    /* Account for global header height */
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out forwards;
    opacity: 0;
}

/* Header */
.app-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 0 3rem;
    margin-bottom: 2rem;
}

.header-content {
    text-align: center;
}

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

.logo-icon {
    background: var(--primary);
    color: white;
    padding: 8px;
    border-radius: var(--radius);
    display: flex;
    box-shadow: var(--shadow-soft);
}

.app-logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--foreground);
}

.subtitle {
    color: var(--muted-foreground);
    font-size: 1.1rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Layout Grid */
.layout-grid {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.sidebar,
.right-sidebar {
    position: relative;
    z-index: 2;
}

.main-content {
    position: relative;
    z-index: 1;
}

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

@media (min-width: 1100px) {
    .layout-grid {
        grid-template-columns: 280px 1fr 280px;
        gap: 2.5rem;
    }
}

.sidebar,
.right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar .card,
.right-sidebar .card {
    margin-bottom: 0;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: visible;
    /* Important for dropdown */
}

.config-card {
    z-index: 5;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border);
    background-color: var(--secondary);
    border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}

.card-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--secondary-foreground);
}

.card-body {
    padding: 2rem;
}

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

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

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

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

.check-list li::before {
    content: '✓';
    color: var(--primary-foreground);
    background-color: #4caf50;
    position: absolute;
    left: 0;
    font-weight: bold;
    font-size: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

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

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

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

.select-wrapper select {
    display: none;
}

.select-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.2rem;
    height: 1.2rem;
    color: var(--primary);
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
}

.custom-select-trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    font-size: 0.95rem;
    background-color: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.custom-select-trigger:hover {
    background-color: var(--secondary);
}

.custom-select-trigger.open {
    border-color: var(--primary);
}

.custom-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-solid);
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    padding: 0;
    overflow: hidden;
}

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

.custom-option {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--foreground);
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

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

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

.custom-option.selected {
    background-color: var(--primary);
    color: white;
}

.arrow {
    width: 16px;
    margin-left: 8px;
    transition: transform 0.2s;
}

.custom-select-trigger.open .arrow {
    transform: rotate(180deg);
}

/* Drop Zone */
#heicFile {
    display: none;
}

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

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background-color: var(--secondary);
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
    margin-top: 1rem;
}

.upload-icon-wrapper {
    color: var(--primary);
    transform: scale(1.6);
    margin-bottom: 1.5rem;
    transition: color 0.3s ease;
}

.drop-zone:hover .upload-icon-wrapper {
    color: #4caf50;
}

/* Pending List */
.selection-area {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
}

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

.badge {
    background: #4caf50;
    color: white;
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.8rem;
}

.pending-list {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 1.5rem;
}

.pending-item {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    animation: slideInRight 0.3s ease;
}

.pending-item:last-child {
    border-bottom: none;
}

.pending-remove {
    color: var(--destructive);
    cursor: pointer;
}

/* Buttons */
.hc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
}

.hc-btn-primary {
    background-color: var(--primary);
    color: white;
    border: 1px solid var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hc-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    background-color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.hc-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hc-btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    min-height: 32px;
}

.hc-btn-ghost {
    background: transparent;
    color: var(--muted-foreground);
    border: 1px solid var(--border);
}

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

.hc-btn-success {
    background-color: #4caf50;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #4caf50;
    width: 100%;
}

.hc-btn-success:hover {
    background-color: #419644;
    border-color: #419644;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.hc-btn-success:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.hc-btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--foreground);
}

.hc-btn-outline:hover {
    background: #fff5f5;
    border-color: var(--destructive);
    color: var(--destructive);
}

.action-buttons {
    text-align: right;
}

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

.file-card {
    border: 1px solid var(--border);
    padding: 0.75rem;
    border-radius: var(--radius);
    background: white;
    text-align: center;
}

.file-preview {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    background: var(--muted);
}

.file-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.file-status {
    font-size: 0.8rem;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.card-remove-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--destructive);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 2px 0 var(--foreground);
}

/* Progress */
.progress-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.progress-bar-track {
    height: 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: #4caf50;
    transition: width 0.3s ease;
}

/* Status */
.status-container {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

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

    .layout-grid {
        grid-template-columns: 1fr;
    }

    .status-container {
        flex-direction: column;
    }

    .hc-btn {
        width: 100%;
    }
}