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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    position: relative;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    background: white;
    border-radius: 20px;
    padding: 40px 60px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 300px;
}

.hourglass {
    font-size: 4em;
    animation: flip 1.5s ease-in-out infinite;
    display: inline-block;
    margin-bottom: 20px;
}

@keyframes flip {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }
}

.loading-text {
    font-size: 1.3em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 0.9em;
    color: #666;
    font-weight: 300;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
    font-weight: 300;
}

.preview-stat-value.reduction-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3em;
}

.traffic-light-card {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.traffic-light-card h3 {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 25px;
    color: #667eea;
    text-align: center;
}

.traffic-light-container {
    display: flex;
    align-items: center;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.traffic-light {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #2c3e50;
    border-radius: 30px;
    width: 80px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.light {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    position: relative;
}

.light.red {
    background: #444;
}

.light.yellow {
    background: #444;
}

.light.green {
    background: #444;
}

.light.active.red {
    background: #e74c3c;
    box-shadow: 0 0 20px #e74c3c, inset 0 0 10px rgba(231, 76, 60, 0.5);
    animation: pulse 2s infinite;
}

.light.active.yellow {
    background: #f39c12;
    box-shadow: 0 0 20px #f39c12, inset 0 0 10px rgba(243, 156, 18, 0.5);
    animation: pulse 2s infinite;
}

.light.active.green {
    background: #27ae60;
    box-shadow: 0 0 20px #27ae60, inset 0 0 10px rgba(39, 174, 96, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.traffic-status {
    flex: 1;
    min-width: 250px;
}

.status-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}

.status-text.green {
    color: #27ae60;
}

.status-text.yellow {
    color: #f39c12;
}

.status-text.red {
    color: #e74c3c;
}

.status-details {
    font-size: 0.95em;
    color: #666;
    text-align: center;
    line-height: 1.6;
    font-weight: 300;
}

.stats-card-inline {
    flex: 1;
    min-width: 400px;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.stats-grid-inline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    height: 100%;
}

.stats-card-inline .stat-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
    height: 100%;
}

.stats-card-inline .stat-item.highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-card-inline .stat-label {
    display: block;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 10px;
    opacity: 0.8;
}

.stats-card-inline .stat-value {
    display: block;
    font-size: 1.5em;
    font-weight: 700;
}

.stats-card-inline .stat-item.highlight .stat-label {
    opacity: 0.9;
}

.upload-section {
    padding: 40px;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.upload-text {
    font-size: 1.2em;
    font-weight: 500;
    color: #667eea;
    margin-bottom: 10px;
}

.upload-hint {
    font-size: 0.9em;
    color: #666;
    font-weight: 300;
}

.legal-notice {
    margin-top: 30px;
    padding: 20px;
    background: #fff9e6;
    border-left: 4px solid #f39c12;
    border-radius: 8px;
    font-size: 0.9em;
}

.legal-notice h2 {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

.legal-notice ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-notice li {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.legal-notice li:last-child {
    margin-bottom: 0;
}

.legal-notice strong {
    color: #333;
    font-weight: 600;
}

.legal-notice-footer {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 8px;
    text-align: left;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.legal-notice-footer h3 {
    font-size: 1em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
}

.legal-notice-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-notice-footer li {
    margin-bottom: 10px;
    line-height: 1.5;
    color: #666;
    font-size: 0.85em;
}

.legal-notice-footer li:last-child {
    margin-bottom: 0;
}

.legal-notice-footer strong {
    color: #333;
    font-weight: 600;
}

.editor-section {
    padding: 40px;
}

.preview-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.preview-box {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.preview-box h3 {
    font-size: 1.2em;
    font-weight: 600;
    margin: 0;
    color: #667eea;
}

.preview-traffic-light {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #2c3e50;
    border-radius: 20px;
    width: 50px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.preview-traffic-light .light {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #333;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.preview-traffic-light .light.active.red {
    background: #e74c3c;
    box-shadow: 0 0 15px #e74c3c, inset 0 0 8px rgba(231, 76, 60, 0.5);
    animation: pulse 2s infinite;
}

.preview-traffic-light .light.active.yellow {
    background: #f39c12;
    box-shadow: 0 0 15px #f39c12, inset 0 0 8px rgba(243, 156, 18, 0.5);
    animation: pulse 2s infinite;
}

.preview-traffic-light .light.active.green {
    background: #27ae60;
    box-shadow: 0 0 15px #27ae60, inset 0 0 8px rgba(39, 174, 96, 0.5);
    animation: pulse 2s infinite;
}

.preview-stats {
    background: white;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    flex-wrap: wrap;
}

.preview-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-stat-label {
    font-size: 0.9em;
    font-weight: 500;
    color: #666;
}

.preview-stat-value {
    font-size: 1.1em;
    font-weight: 700;
    color: #667eea;
}

.preview-stat-status {
    font-size: 0.85em;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: 15px;
    background: #f0f0f0;
    color: #666;
}

.preview-stat-status.green {
    background: #d4edda;
    color: #27ae60;
}

.preview-stat-status.yellow {
    background: #fff3cd;
    color: #f39c12;
}

.preview-stat-status.red {
    background: #f8d7da;
    color: #e74c3c;
}

.image-wrapper {
    position: relative;
    background: white;
    border-radius: 10px;
    padding: 15px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    overflow: hidden;
    cursor: zoom-in;
}

.image-wrapper img,
.image-wrapper canvas {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s ease-out, box-shadow 0.3s ease;
    transform-origin: center center;
}

.image-wrapper:hover img,
.image-wrapper:hover canvas {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.image-info {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.folder-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    border: 2px solid #e0e0e0;
    margin-top: 10px;
}

.folder-card.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.folder-card.clickable:hover {
    background: #f8f9ff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.folder-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.folder-card .folder-icon {
    font-size: 1.8em;
    flex-shrink: 0;
}

.folder-card-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.folder-card-label {
    font-size: 0.85em;
    font-weight: 600;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.folder-card-path {
    font-size: 0.95em;
    color: #333;
    font-weight: 500;
    word-break: break-all;
    overflow-wrap: break-word;
}

.controls-panel {
    background: #f8f9ff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.controls-panel h3 {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 25px;
    color: #667eea;
}

.controls-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
    margin-bottom: 30px;
}

.control-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    border-right: 1px solid #e0e0e0;
    padding-right: 20px;
}

.control-group:first-child {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.control-group:last-child {
    border-right: none;
    padding-right: 0;
}

.control-group label {
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 1.1em;
    cursor: pointer;
    margin-bottom: 10px;
}

.control-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #667eea;
}

.control-options {
    margin-top: 15px;
    margin-left: 30px;
    padding: 15px;
    background: white;
    border-radius: 10px;
}

.input-group {
    margin-bottom: 15px;
    flex: 1;
    min-width: 0;
}

.control-group:first-child .input-group {
    margin-bottom: 0;
    flex: 0 1 auto;
}

.control-group:first-child .input-group:last-child {
    flex: 0 0 auto;
}

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

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.control-group:first-child .input-group label {
    white-space: nowrap;
}

.control-group:first-child .input-group:last-child label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    gap: 8px;
}

.input-group input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    transition: border-color 0.3s;
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

.input-group input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

.input-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
}

.input-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
}

.hint {
    font-size: 0.85em;
    color: #666;
    font-weight: 300;
    margin-top: 8px;
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(17, 153, 142, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .preview-container {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.8em;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .preview-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .preview-stats {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .controls-row {
        flex-direction: column;
    }

    .control-group {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-right: 0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }

    .control-group:last-child {
        border-bottom: none;
        margin-bottom: 0;
    }

    .legal-notice {
        margin-top: 20px;
        padding: 15px;
        font-size: 0.85em;
    }

    .legal-notice h2 {
        font-size: 1em;
    }

    .legal-notice-footer {
        padding: 15px;
    }

    .legal-notice-footer h3 {
        font-size: 0.95em;
    }

    .legal-notice-footer li {
        font-size: 0.8em;
    }
}