/* ========================================
   AI Summarizer - Main Stylesheet
   Glassmorphism Design with 3D Effects
   ======================================== */

/* ========== Reset & Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    
    /* Colors */
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #4facfe;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    
    /* Glass Effect */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.6);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #667eea 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ========== 3D Background Canvas ========== */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* ========== Container ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    position: relative;
    z-index: 1;
}

/* ========== Header ========== */
.header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    animation: fadeInDown 0.8s ease;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    animation: float 3s ease-in-out infinite;
}

.logo-icon svg {
    width: 30px;
    height: 30px;
    color: white;
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* ========== Glass Card ========== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--glass-shadow);
    animation: fadeInUp 0.8s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.glass-card:hover::before {
    left: 100%;
}

.main-card {
    margin-bottom: var(--spacing-lg);
}

.recent-card {
    margin-top: var(--spacing-lg);
}

/* ========== Section Header ========== */
.section-header {
    margin-bottom: var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ========== Stats ========== */
.stats {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
}

/* ========== Input Tabs ========== */
.input-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.tab-btn svg {
    width: 20px;
    height: 20px;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

/* ========== Tab Content ========== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ========== Text Input ========== */
textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    transition: all var(--transition-normal);
}

textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

textarea::placeholder {
    color: var(--text-muted);
}

.char-count {
    margin-top: var(--spacing-sm);
    text-align: right;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.char-count span {
    font-weight: 600;
    color: var(--accent);
}

/* ========== Upload Zone ========== */
.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    background: rgba(79, 172, 254, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--spacing-md);
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.upload-icon svg {
    width: 40px;
    height: 40px;
    color: white;
}

.upload-zone h3 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-xs);
}

.upload-zone p {
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
}

/* ========== File Info ========== */
.file-info {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideInRight 0.3s ease;
}

.file-details {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.file-details svg {
    width: 40px;
    height: 40px;
    color: var(--success);
}

.file-details div {
    display: flex;
    flex-direction: column;
}

.file-details strong {
    color: var(--text-primary);
}

.file-details span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Buttons ========== */
.btn-primary,
.btn-secondary,
.btn-remove,
.btn-refresh {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    min-width: 200px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-remove {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: var(--spacing-xs) var(--spacing-md);
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #fecaca;
}

.btn-refresh {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: var(--spacing-xs);
    width: 36px;
    height: 36px;
}

.btn-refresh:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.btn-refresh svg {
    width: 20px;
    height: 20px;
}

/* ========== Action Buttons ========== */
.action-buttons {
    margin-top: var(--spacing-lg);
    display: flex;
    justify-content: center;
}

.result-actions {
    margin-top: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ========== Loading Spinner ========== */
.spinner {
    animation: rotate 1s linear infinite;
}

.spinner circle {
    stroke: currentColor;
    stroke-dasharray: 1, 150;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.btn-loader svg {
    width: 20px;
    height: 20px;
}

/* ========== Summary Content ========== */
.summary-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1.05rem;
    min-height: 200px;
    transition: opacity 0.3s ease;
}

.summary-content.typing {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Formatted content styles */
.summary-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.summary-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--spacing-md) 0 var(--spacing-sm) 0;
}

.summary-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
}

.summary-content h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin: var(--spacing-sm) 0 var(--spacing-xs) 0;
}

.summary-content p {
    margin: var(--spacing-sm) 0;
    line-height: 1.8;
}

.summary-content strong {
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
}

.summary-content em {
    font-style: italic;
    color: var(--accent);
}

.summary-content ul,
.summary-content ol {
    margin: var(--spacing-sm) 0;
    padding-left: var(--spacing-lg);
}

.summary-content li {
    margin: var(--spacing-xs) 0;
    line-height: 1.7;
}

.summary-content ul li {
    list-style-type: disc;
}

.summary-content ol li {
    list-style-type: decimal;
}

.summary-content hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: var(--spacing-md) 0;
}

.summary-content br {
    content: "";
    display: block;
    margin: 0.25rem 0;
}

/* ========== Recent Summaries ========== */
.recent-summaries {
    display: grid;
    gap: var(--spacing-md);
}

.summary-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all var(--transition-normal);
    animation: fadeIn 0.3s ease;
}

.summary-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(5px);
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.summary-meta {
    display: flex;
    gap: var(--spacing-md);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.summary-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.summary-preview {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.6;
}

.summary-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.btn-icon {
    padding: var(--spacing-xs);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.btn-icon svg {
    width: 16px;
    height: 16px;
}

/* ========== Loading State ========== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.loading-spinner svg {
    width: 50px;
    height: 50px;
    margin-bottom: var(--spacing-sm);
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    opacity: 0.5;
}

/* ========== Footer ========== */
.footer {
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg);
    color: var(--text-secondary);
    animation: fadeIn 1s ease;
}

.footer p {
    margin: 0.25rem 0;
}

.footer strong {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.footer-note {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ========== Toast Notification ========== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    transition: bottom var(--transition-normal);
    max-width: 400px;
    text-align: center;
}

.toast.show {
    bottom: 30px;
}

.toast.success {
    background: rgba(16, 185, 129, 0.9);
}

.toast.error {
    background: rgba(239, 68, 68, 0.9);
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

/* ========== Responsive Design ========== */
@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .glass-card {
        padding: var(--spacing-md);
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .input-tabs {
        flex-direction: column;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn-secondary {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5rem;
    }
    
    .logo-icon {
        width: 40px;
        height: 40px;
    }
    
    .logo-icon svg {
        width: 24px;
        height: 24px;
    }
}
