/* ============================================
   Complete Image Suite - Main Styles
   ============================================ */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1f2937;
    --light: #f8fafc;
    --gray: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.5rem;
    border-radius: 60px;
}

.logo i {
    font-size: 1.5rem;
    color: white;
}

.logo span {
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
}

.session-badge {
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 0.5rem 1.2rem;
    border-radius: 60px;
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Hero */
.hero {
    text-align: center;
    margin-bottom: 1.5rem;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
}

/* Main Container */
.main-container {
    display: grid;
    grid-template-columns: 280px 1fr 260px;
    gap: 1rem;
    background: white;
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: var(--shadow);
}

/* Tools Panel */
.tools-panel {
    background: #f8fafc;
    border-right: 1px solid var(--border);
    padding: 1rem;
    max-height: 85vh;
    overflow-y: auto;
}

.tool-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.tab-btn {
    flex: 1;
    min-width: 65px;
    padding: 0.5rem 0.3rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.tab-btn i {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 1rem;
}

.tab-btn span {
    font-size: 0.65rem;
}

.tab-btn:hover {
    background: #e5e7eb;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--light);
}

.upload-area i {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.upload-area p {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.upload-area small {
    font-size: 0.7rem;
    color: var(--gray);
}

/* Tool Groups */
.tool-group {
    margin-bottom: 1rem;
}

.tool-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--dark);
}

.tool-group label i {
    margin-right: 0.3rem;
    color: var(--primary);
}

.tool-group input[type="range"] {
    width: calc(100% - 50px);
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    -webkit-appearance: none;
}

.tool-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.tool-group input[type="range"] + span,
.tool-group input[type="range"] ~ span {
    width: 40px;
    display: inline-block;
    text-align: right;
    font-size: 0.7rem;
    color: var(--gray);
}

.tool-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.8rem;
}

.tool-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-size: 0.8rem;
}

/* Filter Grid */
.filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.filter-card i {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.2rem;
}

.filter-card span {
    font-size: 0.65rem;
}

/* Effect Grid */
.effect-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.effect-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.effect-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.effect-card i {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 0.2rem;
}

.effect-card span {
    font-size: 0.65rem;
}

/* Buttons */
.apply-btn {
    width: 100%;
    padding: 0.6rem;
    margin-top: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
}

.apply-btn:hover {
    transform: translateY(-2px);
}

.reset-btn {
    background: var(--gray);
    margin-top: 0.3rem;
}

.reset-btn:hover {
    background: #5a6268;
}

.small-btn {
    padding: 0.4rem 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.3rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.7rem;
}

.small-btn:hover {
    background: var(--primary-dark);
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* Canvas Panel */
.canvas-panel {
    padding: 1rem;
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.canvas-container {
    background: #e5e7eb;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    width: 100%;
    overflow: auto;
    position: relative;
}

#imageCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.image-placeholder {
    text-align: center;
    color: var(--gray);
    padding: 4rem;
}

.image-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.canvas-controls {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.canvas-controls button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.canvas-controls button:hover {
    background: var(--primary);
    color: white;
}

/* Actions Panel */
.actions-panel {
    background: #f8fafc;
    border-left: 1px solid var(--border);
    padding: 1rem;
}

.action-group {
    margin-bottom: 1.5rem;
}

.action-group h4 {
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 0.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn:hover {
    border-color: var(--primary);
    background: var(--light);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reset-btn {
    background: var(--danger);
    color: white;
    border: none;
}

.reset-btn:hover {
    background: #dc2626;
}

/* Info Group */
.info-group {
    background: var(--light);
    border-radius: 0.5rem;
    padding: 0.8rem;
    margin-bottom: 1rem;
}

.info-group h4 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    padding: 0.2rem 0;
    color: var(--gray);
}

.info-row span:last-child {
    font-weight: 600;
    color: var(--dark);
}

/* Compress Info */
.compress-info {
    background: var(--light);
    border-radius: 0.5rem;
    padding: 0.8rem;
    margin: 0.5rem 0;
}

/* Upload History */
.upload-history {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
}

.upload-history h4 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

#historyList {
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.7rem;
}

.history-item:hover {
    background: var(--light);
}

.history-item img {
    width: 30px;
    height: 30px;
    object-fit: cover;
    border-radius: 0.3rem;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    margin-top: 1.5rem;
    font-size: 0.85rem;
}

.back-link:hover {
    color: white;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
}

/* Responsive */
@media (max-width: 1100px) {
    .main-container {
        grid-template-columns: 260px 1fr;
    }
    .actions-panel {
        display: none;
    }
}

@media (max-width: 800px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    .tools-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 400px;
    }
    .tool-tabs {
        justify-content: center;
    }
    .tab-btn {
        min-width: 55px;
    }
}

@media (max-width: 500px) {
    .hero h1 {
        font-size: 1.5rem;
    }
    .filter-grid, .effect-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}