/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* ============================================================================
   CONTAINER & LAYOUT
   ============================================================================ */

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    color: white;
}

.header-content {
    animation: slideDown 0.6s ease-out;
}

.logo {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 300;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* ============================================================================
   SECTIONS
   ============================================================================ */

section {
    animation: fadeIn 0.6s ease-out;
}

/* ============================================================================
   AUTH SECTION
   ============================================================================ */

.auth-section {
    display: flex;
    justify-content: center;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-card h2 {
    margin-bottom: 10px;
    color: #667eea;
    font-size: 1.8rem;
}

.auth-description {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================================================
   TOKEN DISPLAY
   ============================================================================ */

.token-display {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
}

.token-label {
    color: #4caf50;
    font-weight: 600;
    margin-bottom: 10px;
}

.token-box {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    overflow-x: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.token-box code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    flex: 1;
    color: #333;
}

/* ============================================================================
   UPLOAD SECTION
   ============================================================================ */

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
}

.upload-header h2 {
    font-size: 2rem;
}

/* ============================================================================
   DROP ZONE
   ============================================================================ */

.drop-zone {
    background: white;
    border: 3px dashed #667eea;
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.drop-zone:hover {
    border-color: #764ba2;
    background: #f8f8ff;
    transform: translateY(-2px);
}

.drop-zone.drag-over {
    background: #f0f0ff;
    border-color: #764ba2;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

.drop-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    display: inline-block;
    animation: bounce 2s infinite;
}

.drop-zone h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 1.5rem;
}

.drop-zone p {
    color: #666;
    margin-bottom: 10px;
}

.supported-text {
    font-size: 0.9rem;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   OPTIONS SECTION
   ============================================================================ */

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

.option-group {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.option-group label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.option-group select {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ============================================================================
   FILE INFO
   ============================================================================ */

.file-info {
    background: white;
    border-radius: 12px;
    padding: 20px;
}

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

.file-details p {
    color: #333;
}

.file-details strong {
    color: #667eea;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-copy {
    background: #f0f0f0;
    color: #333;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-copy:hover {
    background: #e0e0e0;
}

.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
}

.btn-loader {
    display: inline-block;
    animation: spin 1s linear infinite;
}

.btn-loader.hidden {
    display: none;
}

.btn-text.hidden {
    display: none;
}

/* ============================================================================
   RESULT SECTION
   ============================================================================ */

.result-section {
    animation: slideUp 0.6s ease-out;
}

.result-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.result-header h2 {
    color: #4caf50;
    font-size: 1.8rem;
}

.result-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.result-item {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.result-item > label {
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.result-text {
    background: #f9f9f9;
    border-left: 4px solid #4caf50;
    padding: 20px;
    border-radius: 8px;
    line-height: 1.8;
    color: #333;
    max-height: 400px;
    overflow-y: auto;
}

.result-text p {
    margin: 0;
    word-wrap: break-word;
}

.result-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.metadata-item .label {
    font-weight: 600;
    color: #666;
    font-size: 0.9rem;
}

.metadata-item .value {
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
    word-break: break-all;
}

/* ============================================================================
   FORMATS SECTION
   ============================================================================ */

.formats-section {
    background: white;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.formats-section h2 {
    margin-bottom: 30px;
    color: #333;
    text-align: center;
    font-size: 1.8rem;
}

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

.format-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.format-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.format-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.format-card h3 {
    color: #333;
    margin-bottom: 8px;
}

.format-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.format-card .specs {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.footer p {
    margin: 5px 0;
    font-size: 0.95rem;
}

.footer-text {
    font-size: 0.85rem;
    opacity: 0.9;
}

.footer-text code {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.footer-text a {
    color: white;
    text-decoration: none;
    border-bottom: 2px solid white;
}

.footer-text a:hover {
    opacity: 0.8;
}

/* ============================================================================
   LOADING OVERLAY
   ============================================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loadingText {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #333;
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    background: #4caf50;
}

.toast.error {
    background: #f44336;
}

.toast.info {
    background: #2196f3;
}

/* ============================================================================
   ERROR MESSAGE
   ============================================================================ */

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-message.hidden {
    display: none;
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

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

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

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .header {
        margin-bottom: 30px;
        padding: 30px 15px;
    }

    .logo {
        font-size: 2rem;
    }

    .auth-card {
        padding: 30px 20px;
    }

    .drop-zone {
        padding: 40px 15px;
    }

    .formats-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .result-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .result-metadata {
        grid-template-columns: 1fr;
    }

    .options-section {
        grid-template-columns: 1fr;
    }

    .toast-container {
        left: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.5rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .drop-icon {
        font-size: 2rem;
    }

    .drop-zone h3 {
        font-size: 1.2rem;
    }

    .formats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
