:root {
    --win7-blue: #004275;
    --win7-light-blue: #7bb5ea;
    --win7-glass: rgba(255, 255, 255, 0.45);
    --win7-border: rgba(255, 255, 255, 0.8);
    --win7-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body.aero-theme {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: url('asset_name.png') no-repeat center center fixed;
    background-size: cover;
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    overflow: hidden;
}

/* Window Container */
.desktop-window {
    width: 95vw;
    height: 90vh;
    max-width: 1000px;
    background: var(--win7-glass);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 8px;
    border: 1px solid var(--win7-border);
    box-shadow: var(--win7-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Aero Glass Effect Helpers */
.aero-glass {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Title Bar */
.title-bar {
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    cursor: default;
    user-select: none;
}

.title-bar-text {
    font-size: 13px;
    font-weight: 400;
    color: #000;
    text-shadow: 0 0 5px #fff;
}

.title-bar-controls {
    display: flex;
    gap: 2px;
}

.title-bar-controls button {
    width: 30px;
    height: 20px;
    border: 1px solid rgba(0,0,0,0.3);
    background: linear-gradient(to bottom, #f3f3f3 0%, #ebebeb 50%, #dcdcdc 51%, #c5c5c5 100%);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.1s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.title-bar-controls button:hover {
    filter: brightness(1.1);
}

.title-bar-controls button:active {
    filter: brightness(0.9);
}

.title-bar-controls button::before {
    content: '';
    display: block;
    pointer-events: none;
}

/* Minimize icon */
.title-bar-controls button[aria-label="Minimize"]::before {
    width: 8px;
    height: 2px;
    background: #000;
    margin-top: 8px;
}

/* Maximize icon */
.title-bar-controls button[aria-label="Maximize"]::before {
    width: 9px;
    height: 7px;
    border: 1px solid #000;
    border-top-width: 2px;
}

/* Close button and icon */
.title-bar-controls button[aria-label="Close"] {
    background: linear-gradient(to bottom, #f0948b 0%, #ea6153 50%, #d12d1c 51%, #b11f11 100%);
    border-color: #8c1a0f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

.title-bar-controls button[aria-label="Close"]::before {
    content: '×';
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 2px;
}

/* Window States */
.desktop-window.maximized {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0;
}

.desktop-window.minimized {
    height: auto !important;
    align-self: flex-end;
}

.desktop-window.minimized .window-body,
.desktop-window.minimized .status-bar {
    display: none;
}

.desktop-window.closed {
    display: none;
}

/* Body Layout */
.window-body {
    flex: 1;
    display: flex;
    padding: 10px;
    gap: 10px;
    overflow: hidden;
    background: #f0f0f0;
}

.controls-panel {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.05);
    overflow-y: auto;
}

.preview-panel {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ebebeb;
    border: 1px solid #ccc;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

/* Buttons */
.win7-btn {
    appearance: none;
    background: linear-gradient(to bottom, #f2f2f2 0%, #ebebeb 50%, #dddddd 51%, #cfcfcf 100%);
    border: 1px solid #707070;
    border-radius: 3px;
    padding: 5px 12px;
    font-size: 12px;
    color: #000;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.1s;
}

.btn-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    pointer-events: none;
}

.win7-btn:hover {
    background: linear-gradient(to bottom, #eaf6fd 0%, #d9f0fc 50%, #bee6fd 51%, #a7d9f5 100%);
    border-color: #3c7fb1;
    box-shadow: inset 0 1px 0 #fff, 0 0 5px rgba(60, 127, 177, 0.4);
}

.win7-btn:active {
    background: linear-gradient(to bottom, #daecf4 0%, #c4e5f6 50%, #98d1ef 51%, #68b3db 100%);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

.win7-btn.main-action {
    background: linear-gradient(to bottom, #7bb5ea, #004275);
    color: #fff;
    border-color: #003a66;
}

.win7-btn.danger {
    background: linear-gradient(to bottom, #ff9999, #cc0000);
    color: #fff;
    border-color: #990000;
}

.win7-btn.recording {
    animation: win-pulse 1s infinite alternate;
}

@keyframes win-pulse {
    from { box-shadow: 0 0 5px #f00; }
    to { box-shadow: 0 0 15px #f00; }
}

/* Controls Components */
.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#imageInput { display: none; }

fieldset {
    border: 1px solid #d0d0d0;
    border-radius: 3px;
    padding: 10px;
    margin: 0;
}

legend {
    font-size: 12px;
    color: #004275;
    padding: 0 5px;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

select, input[type="number"], textarea {
    padding: 3px 5px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 12px;
    background: #fff;
}

select:focus, input[type="number"]:focus {
    border-color: #3c7fb1;
    outline: none;
    box-shadow: 0 0 3px rgba(60, 127, 177, 0.3);
}

.control-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 10px;
    align-items: center;
    font-size: 11px;
}

.control-grid label {
    text-align: right;
    color: #333;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.input-group input { width: 45px; }

.range-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

.val-badge {
    min-width: 25px;
    background: #e1e1e1;
    padding: 1px 4px;
    border-radius: 2px;
    text-align: center;
    font-size: 10px;
}

/* Range Slider Styling - Win7/Vista Style */
input[type="range"] {
    appearance: none;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    flex: 1;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: linear-gradient(to bottom, #fff, #999);
    border: 1px solid #666;
    border-radius: 50%;
    cursor: pointer;
}

/* Canvas Display */
.canvas-container {
    padding: 5px;
    background: #000;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    max-width: 100%;
    max-height: 100%;
    display: flex;
}

#outputCanvas {
    max-width: 100%;
    max-height: 100%;
    /* image-rendering is controlled dynamically in main.js via canvas.style */
}

/* Status Bar */
.status-bar {
    height: 22px;
    background: #f0f0f0;
    border-top: 1px solid #ccc;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 11px;
    gap: 10px;
}

.status-sep {
    width: 1px;
    height: 14px;
    background: #ccc;
}

/* Modal Styling */
.modal {
    position: fixed;
    z-index: 100;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 450px;
    max-height: 80vh;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content .title-bar {
    padding: 5px 10px;
}

.close-button {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.gallery-grid {
    padding: 15px;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    overflow-y: auto;
}

.gallery-item {
    border: 1px solid #ccc;
    padding: 4px;
    background: #f9f9f9;
    cursor: pointer;
}

.gallery-item:hover {
    border-color: #3c7fb1;
    background: #eaf6fd;
}

.gallery-item img {
    width: 100%;
    display: block;
}

.gallery-item-label {
    font-size: 10px;
    text-align: center;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}