/* =========================================
   VARIABLES & RESET
   ========================================= */
:root {
    --primary: #2563eb;       
    --primary-hover: #1d4ed8; 
    --primary-light: #eff6ff; 
    --bg-body: #f1f5f9;       
    --bg-sidebar: #ffffff;    
    --text-main: #0f172a;     
    --text-muted: #64748b;    
    --border-color: #cbd5e1;  
    --danger: #ef4444;        
    --success: #10b981;       
    --sidebar-width: 380px;
    --card-radius: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', sans-serif; background-color: var(--bg-body); color: var(--text-main); height: 100vh; display: flex; overflow: hidden; font-size: 15px; }

/* =========================================
   SIDEBAR
   ========================================= */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    padding: 2rem;
    display: flex; flex-direction: column; gap: 1.5rem;
    border-right: 1px solid var(--border-color);
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
    overflow-y: auto; z-index: 10;
}

.logo {
    font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: 12px;
    color: var(--primary); margin-bottom: 1rem; letter-spacing: -0.5px;
}
.logo img { height: 45px; width: auto; filter: drop-shadow(0 4px 6px rgba(37, 99, 235, 0.2)); }

.control-group { display: flex; flex-direction: column; gap: 0.5rem; }
.control-group label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

select {
    width: 100%; padding: 14px 18px; border-radius: 12px;
    border: 2px solid var(--border-color); background-color: #fff;
    font-family: inherit; font-size: 1rem; color: var(--text-main);
    cursor: pointer; transition: all 0.2s ease; font-weight: 500; appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 1rem center; background-size: 1.2em;
}
select:hover { border-color: #94a3b8; }
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); }

.history-section { flex-grow: 1; background: #f8fafc; padding: 1.2rem; border-radius: 16px; border: 2px dashed var(--border-color); display: flex; flex-direction: column; min-height: 200px; }
.history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.history-header h4 { font-size: 0.9rem; color: var(--text-main); font-weight: 700; }
.clear-btn { font-size: 0.8rem; color: var(--danger); background: none; border: none; cursor: pointer; font-weight: 600; }
.history-list { list-style: none; overflow-y: auto; flex: 1; padding-right: 5px; }
.history-item { display: flex; justify-content: space-between; align-items: center; background: white; padding: 10px; border-radius: 8px; margin-bottom: 8px; border: 1px solid #e2e8f0; transition: transform 0.2s; }
.history-item:hover { transform: translateX(3px); border-color: var(--primary); }
.history-info { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.history-name { font-weight: 600; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.history-date { font-size: 0.7rem; color: var(--text-muted); }
.history-badge { font-size: 0.65rem; background: var(--primary-light); color: var(--primary); padding: 2px 6px; border-radius: 4px; width: fit-content; font-weight: 600; }
.btn-download-mini { color: var(--primary); background: #eff6ff; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; text-decoration: none; transition: 0.2s; }
.btn-download-mini:hover { background: var(--primary); color: white; }
.empty-msg { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-top: 1.5rem; font-style: italic; background: none; border: none; }
.footer-copy { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin-top: auto; }

/* =========================================
   MAIN CONTENT
   ========================================= */
.main-content { flex: 1; position: relative; padding: 3rem; display: flex; justify-content: center; align-items: center; background-color: var(--bg-body); }
.shape { position: absolute; border-radius: 50%; filter: blur(80px); z-index: 1; opacity: 0.6; }
.shape-1 { top: 10%; left: 10%; width: 300px; height: 300px; background: rgba(37, 99, 235, 0.2); }
.shape-2 { bottom: 10%; right: 10%; width: 400px; height: 400px; background: rgba(16, 185, 129, 0.15); }

.card {
    background: white; padding: 3rem; border-radius: var(--card-radius);
    box-shadow: 0 20px 50px -10px rgba(0,0,0,0.08); width: 100%; max-width: 750px;
    text-align: center; position: relative; z-index: 2; border: 1px solid rgba(255,255,255,0.8);
    display: flex; flex-direction: column;
}

.tab-container {
    display: flex; gap: 8px; margin-bottom: 2.5rem; background: #f1f5f9;
    padding: 6px; border-radius: 16px; width: 100%; max-width: 500px;
    margin-left: auto; margin-right: auto;
}
.tab-btn {
    flex: 1; padding: 10px 15px; border: none; background: transparent;
    border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--text-muted);
    transition: all 0.3s; display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 0.9rem; font-family: inherit;
}
.tab-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.5); }
.tab-btn.active { background: white; color: var(--primary); box-shadow: 0 4px 10px rgba(0,0,0,0.05); transform: scale(1.02); }

.title-wrapper { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 0.5rem; flex-wrap: wrap; }
.card-title { font-size: 2.2rem; color: var(--text-main); font-weight: 800; line-height: 1.2; margin: 0; }
.eyes-container { display: flex; gap: 10px; }
.eye { width: 45px; height: 45px; background: #ffffff; border-radius: 50%; border: 3px solid var(--text-main); position: relative; box-shadow: inset 0 0 8px rgba(0,0,0,0.1); }
.pupil { width: 18px; height: 18px; background-color: var(--primary); border-radius: 50%; position: absolute; top: 50%; left: 50%; margin-top: -9px; margin-left: -9px; transition: transform 0.05s linear; }
.card-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 2rem; }

.drop-zone { border: 3px dashed var(--border-color); border-radius: 20px; padding: 3rem 1.5rem; margin-bottom: 2rem; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); background: #fafafa; cursor: pointer; animation: fadeIn 0.4s ease; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-4px); }
.drop-zone h3 { font-size: 1.3rem; margin-bottom: 15px; color: var(--text-main); }
.icon-upload { font-size: 4rem; color: var(--primary); margin-bottom: 1.5rem; transition: transform 0.3s; }
.drop-zone:hover .icon-upload { transform: scale(1.1); }

.upload-options { display: flex; justify-content: center; margin-top: 10px; }
.btn-upload { background-color: var(--primary); color: white; padding: 12px 30px; border-radius: 50px; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 1rem; font-weight: 600; transition: all 0.3s; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); }
.btn-upload:hover { background-color: var(--primary-hover); transform: translateY(-2px); }

.limit-info { margin-top: 15px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; opacity: 0.8; }

#urlInputContainer { margin-bottom: 2rem; animation: fadeIn 0.3s ease; }
.url-wrapper { display: flex; align-items: center; background: #f8fafc; border: 2px solid var(--border-color); border-radius: 16px; padding: 5px 20px; transition: all 0.3s; }
.url-wrapper:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15); background: white; }
.url-wrapper i { color: var(--text-muted); font-size: 1.2rem; margin-right: 15px; }
.url-wrapper input { flex: 1; border: none; background: transparent; padding: 15px 0; font-size: 1.1rem; font-family: inherit; color: var(--text-main); outline: none; }

.file-preview { display: none; justify-content: space-between; align-items: center; margin-bottom: 2rem; background: #f8fafc; padding: 16px 24px; border-radius: 16px; border: 2px solid var(--border-color); animation: fadeIn 0.3s ease; }
.file-info { display: flex; align-items: center; gap: 15px; overflow: hidden; }
.file-info span { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.icon-file { color: var(--primary); font-size: 1.8rem; }
.btn-close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; transition: color 0.2s; }
.btn-close:hover { color: var(--danger); }

.convert-btn { width: 100%; padding: 20px; border: none; border-radius: 16px; background: var(--primary); color: white; font-size: 1.1rem; font-weight: 700; cursor: pointer; opacity: 0.6; pointer-events: none; transition: all 0.3s; display: flex; justify-content: center; align-items: center; gap: 12px; box-shadow: 0 10px 20px -5px rgba(37, 99, 235, 0.3); }
.convert-btn:not([disabled]) { opacity: 1; pointer-events: auto; }
.convert-btn:hover:not([disabled]) { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 15px 25px -5px rgba(37, 99, 235, 0.4); }

.loader { display: none; width: 24px; height: 24px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top: 3px solid #fff; animation: spin 1s linear infinite; }

.result-container { margin-top: 20px; padding-top: 20px; border-top: 2px dashed var(--border-color); animation: fadeIn 0.5s ease; }
.status-msg { margin: 15px 0; padding: 12px; border-radius: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.95rem; }
.success-msg { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.btn-download-result { width: 100%; padding: 16px; border: none; border-radius: 14px; background: var(--success); color: white; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; display: flex; justify-content: center; align-items: center; gap: 8px; box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3); }
.btn-download-result:hover { background: #059669; transform: translateY(-2px); }

.error-msg { color: var(--danger); margin-top: 20px; font-weight: 600; font-size: 0.9rem; animation: fadeIn 0.3s; }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile */
@media (max-width: 900px) {
    body { flex-direction: column; height: auto; overflow-y: auto; }
    .sidebar { width: 100%; height: auto; padding: 1.5rem; border-right: none; border-bottom: 1px solid var(--border-color); }
    .history-section { max-height: 250px; margin-top: 10px; }
    .main-content { padding: 1.5rem; }
    .card { padding: 2rem 1.5rem; border-radius: 20px; }
    .card-title { font-size: 1.8rem; }
    .tab-container { flex-wrap: wrap; }
    .tab-btn { flex: 1 1 40%; font-size: 0.85rem; }
    .shape { display: none; }
}
