/* Image Resize Specific Styles */

.page-header {
    text-align: center;
    padding: 2rem 0 3rem;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.page-header p,
.page-header .lead-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto;
}

/* Resize Section */
.resize-section {
    margin-bottom: 4rem;
}

/* Upload Area */
.upload-area {
    background: var(--bg-white);
    border: 3px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 4rem 2rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.upload-area:active {
    transform: scale(0.99);
}

.upload-content {
    max-width: 500px;
    margin: 0 auto;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.upload-content h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.upload-content .btn {
    display: inline-block;
    min-width: 150px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Editor Area */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

/* Preview Section */
.preview-section {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.preview-section h3,
.preview-section h4 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.preview-section h4 {
    font-size: 1.1rem;
    margin-top: 2rem;
}

/* Crop Container */
.crop-container {
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.crop-area {
    position: relative;
    max-width: 100%;
    margin: 0 auto;
    display: inline-block;
    user-select: none;
}

#crop-image {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Crop Box */
.crop-box {
    position: absolute;
    border: 2px solid #4a90e2;
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-overlay {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

/* Crop Handles */
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid #4a90e2;
    border-radius: 50%;
    z-index: 10;
}

.crop-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle-w { top: 50%; left: -6px; transform: translateY(-50%); cursor: w-resize; }
.crop-handle-e { top: 50%; right: -6px; transform: translateY(-50%); cursor: e-resize; }

/* Crop Grid */
.crop-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    pointer-events: none;
}

.crop-grid-line {
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.crop-grid-v {
    border-left: 1px solid rgba(255, 255, 255, 0.5);
    border-right: none;
    border-top: none;
    border-bottom: none;
}

.crop-grid-h {
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-right: none;
    border-left: none;
    border-bottom: none;
}

/* Preview Result */
.preview-result {
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.preview-container {
    background: 
        linear-gradient(45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f0f0f0 75%), 
        linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    margin-bottom: 1.5rem;
}

#preview-canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.image-info {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 6px;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--primary-color);
    font-weight: 600;
}

/* Controls Section */
.controls-section {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.controls-section h3 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    cursor: pointer;
}

.control-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Size Inputs */
.size-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.5rem;
}

.lock-icon {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    opacity: 0.5;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group input[type="number"],
.form-group input[type="range"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group input[type="range"] {
    padding: 0;
    height: 6px;
    background: var(--bg-light);
    border: none;
}

.form-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
}

.form-group input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

.scale-value,
#quality-value {
    font-weight: 600;
    color: var(--primary-color);
}

/* Preset Buttons */
.preset-buttons,
.format-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.preset-btn,
.format-btn {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
}

.preset-btn:hover,
.format-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.format-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 2rem;
}

.btn-primary {
    background: var(--primary-color);
}

.btn-primary:hover {
    background: var(--secondary-color);
}

.btn-success {
    background: var(--accent-color);
}

.btn-success:hover {
    background: #45b369;
}

/* Guide Section */
.guide-section {
    margin-bottom: 4rem;
}

.guide-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 2rem;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.guide-card {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.guide-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.guide-card h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.guide-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Tips Section */
.tips-section {
    background: var(--bg-white);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 4rem;
}

.tips-section h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tips-list {
    display: grid;
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

.tip-item {
    padding: 1rem 1.5rem;
    background: var(--bg-light);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    line-height: 1.6;
}

.tip-item strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .controls-section {
        order: -1;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 2rem;
    }

    .upload-area {
        padding: 3rem 1.5rem;
    }

    .upload-icon {
        font-size: 3rem;
    }

    .upload-content h3 {
        font-size: 1.2rem;
    }

    .size-inputs {
        grid-template-columns: 1fr;
    }

    .lock-icon {
        display: none;
    }

    .preset-buttons,
    .format-buttons {
        grid-template-columns: 1fr;
    }

    .guide-grid {
        grid-template-columns: 1fr;
    }
    
    .crop-container {
        padding: 1rem;
    }
    
    .crop-area {
        max-width: 100%;
    }
    
    #crop-image {
        max-width: 100%;
    }
    
    .crop-handle {
        width: 18px;
        height: 18px;
        border-width: 3px;
    }
    
    .crop-handle-nw { top: -9px; left: -9px; }
    .crop-handle-ne { top: -9px; right: -9px; }
    .crop-handle-sw { bottom: -9px; left: -9px; }
    .crop-handle-se { bottom: -9px; right: -9px; }
    .crop-handle-n { top: -9px; }
    .crop-handle-s { bottom: -9px; }
    .crop-handle-w { left: -9px; }
    .crop-handle-e { right: -9px; }
}

@media (max-width: 480px) {
    .preview-container {
        min-height: 300px;
        padding: 1rem;
    }
    
    .preview-result {
        padding: 1rem;
        min-height: 150px;
    }
    
    .upload-area {
        padding: 2rem 1rem;
        border-width: 2px;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .upload-content h3 {
        font-size: 1.1rem;
    }
    
    .upload-content p {
        font-size: 0.9rem;
    }
    
    .crop-container {
        padding: 0.5rem;
    }
    
    .controls-section {
        padding: 1rem;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .format-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    input[type="file"] {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0,0,0,0);
        border: 0;
    }
}
