/* ===================================
   CSS Sprite Generator - Estilos
   =================================== */

:root {
    --color-primary: #6366f1;
    --color-secondary: #8b5cf6;
    --color-success: #10b981;
    --color-info: #3b82f6;
    --color-danger: #ef4444;
    --color-orange: #FB923C;
    --color-dark: #1e1b4b;
    --color-darker: #0f172a;
    --color-light: #f1f5f9;
    --color-border: #334155;
    --color-text: #e2e8f0;
    --color-text-muted: #94a3b8;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--color-darker) 0%, var(--color-dark) 100%);
    color: var(--color-text);
    min-height: 100vh;
    padding: 20px;
}

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

/* ===================================
   Header
   =================================== */

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 20px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 48px;
    animation: spin 3s linear infinite;
    display: inline-block;
    transform-origin: center;
}

.logo-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    transform-origin: center;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.header h1 {
    font-size: 48px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header h1 .suite-text {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: #e6eaf2;
    background-clip: unset;
    color: #e6eaf2;
}

.subtitle {
    font-size: 18px;
    color: var(--color-text-muted);
    margin-top: 10px;
}

.btn-back {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--color-text);
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 600;
}

.btn-back:hover {
    background: rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* ===================================
   Upload Section
   =================================== */

.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    background: rgba(30, 27, 75, 0.5);
    border: 3px dashed var(--color-border);
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--color-orange);
    background: rgba(251, 146, 60, 0.1);
}

.upload-area.dragover {
    border-color: var(--color-orange);
    background: rgba(251, 146, 60, 0.2);
    transform: scale(1.02);
}

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

.upload-area h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--color-text);
}

.upload-area p {
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

/* ===================================
   Buttons
   =================================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-info {
    background: var(--color-info);
    color: white;
}

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

.btn-generate {
    background: linear-gradient(135deg, #FB923C, #F97316);
    color: white;
    font-size: 20px;
    padding: 16px 40px;
}

/* ===================================
   Images Section
   =================================== */

.images-section {
    margin-bottom: 40px;
}

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

.section-header h2 {
    font-size: 24px;
    color: var(--color-text);
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text);
}

.input-spacing,
.select-layout {
    padding: 8px 12px;
    background: var(--color-darker);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
}

.input-spacing {
    width: 70px;
}

.select-layout {
    width: 120px;
}

/* Configuration Section */
.config-section {
    margin-bottom: 30px;
}

.config-card {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    padding: 25px;
}

.config-card h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--color-text);
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

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

.config-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text);
}

.label-text {
    font-weight: 600;
    color: var(--color-text);
}

.unit {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 5px;
}

.input-text {
    padding: 10px 12px;
    background: var(--color-darker);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-family: 'Consolas', monospace;
}

.input-text:focus {
    outline: none;
    border-color: var(--color-primary);
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.image-item {
    background: rgba(30, 27, 75, 0.5);
    border-radius: 12px;
    padding: 15px;
    border: 2px solid var(--color-border);
    position: relative;
    transition: all 0.3s ease;
}

.image-item:hover {
    border-color: var(--color-orange);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.image-preview {
    width: 100%;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-darker);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-name {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.image-size {
    font-size: 11px;
    color: var(--color-text-muted);
    text-align: center;
}

.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-remove-image:hover {
    background: var(--color-danger);
    transform: scale(1.1);
}

/* ===================================
   Generate Section
   =================================== */

.generate-section {
    text-align: center;
    margin-bottom: 40px;
}

/* ===================================
   Result Section
   =================================== */

.result-section {
    margin-bottom: 40px;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 1024px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    background: rgba(30, 27, 75, 0.5);
    border-radius: 16px;
    padding: 25px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
}

.result-card h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--color-text);
}

.sprite-preview {
    background: var(--color-darker);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    max-height: 500px;
    overflow: auto;
}

.sprite-preview img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--color-border);
    border-radius: 8px;
}

.code-textarea {
    width: 100%;
    min-height: 400px;
    padding: 20px;
    background: var(--color-darker);
    border: 2px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
    margin-bottom: 20px;
}

.code-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.result-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.sprite-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 14px;
    color: var(--color-text-muted);
}

/* ===================================
   Loading Overlay
   =================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(251, 146, 60, 0.2);
    border-top-color: var(--color-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-overlay p {
    margin-top: 20px;
    font-size: 18px;
    color: var(--color-text);
}

/* ===================================
   Footer
   =================================== */

.footer {
    text-align: center;
    padding: 40px 20px;
    margin-top: 80px;
    background: rgba(30, 27, 75, 0.5);
    border-top: 2px solid var(--color-border);
    border-radius: 16px 16px 0 0;
}

.footer p {
    font-size: 16px;
    color: var(--color-text);
    margin: 0;
    line-height: 1.8;
}

.footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 700;
    font-size: 18px;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
}

.footer a:hover {
    color: var(--color-secondary);
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .controls {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .controls label {
        width: 100%;
    }
    
    .input-spacing,
    .select-layout {
        width: 100%;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}
