/* RipRaven Styles - Extracted from reader template */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    line-height: 1.6;
}

.header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    background: #2d2d2d;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid #ff6b35;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.header-content {
    flex: 1 1 0%;
}

.header.collapsed {
    padding: 0.75rem 1rem;
}

.header.collapsed .header-content {
    display: none;
}

.header-toggle {
    background: #ff6b35;
    color: #ffffff;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    min-width: 120px;
    transition: background-color 0.2s ease;
}

.header-toggle:hover {
    background: #e55a2b;
}

.header h1 {
    color: #ff6b35;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    color: #cccccc;
    font-weight: 500;
}

select {
    background: #3d3d3d;
    color: #ffffff;
    border: 1px solid #555;
    padding: 0.5rem;
    border-radius: 4px;
    min-width: 150px;
}

select:focus {
    outline: none;
    border-color: #ff6b35;
}

.status {
    background: #333;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: #aaa;
    font-size: 0.9rem;
}

.recent-section {
    background: #2a2a2a;
    margin: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
}

.recent-title {
    color: #ff6b35;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.recent-list {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.recent-item {
    background: #3d3d3d;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid #555;
}

.recent-item:hover {
    background: #4d4d4d;
    border-color: #ff6b35;
    transform: translateY(-2px);
}

.comic-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.comic-page {
    margin: 0;
    padding: 0;
    text-align: center;
    line-height: 0;
}

.comic-page img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Floating Chapter Indicator */
.chapter-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(45, 45, 45, 0.95);
    color: #ff6b35;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    border: 2px solid #ff6b35;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.chapter-indicator.hidden {
    opacity: 0;
    transform: translateX(100px);
}

/* Chapter Divider */
.chapter-divider {
    margin: 2rem 0;
    text-align: center;
    position: relative;
}

.chapter-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, #ff6b35, transparent);
}

.chapter-divider-text {
    background: #1a1a1a;
    color: #ff6b35;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid #ff6b35;
    display: inline-block;
    position: relative;
    z-index: 1;
}

/* Download Status Indicator */
.download-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(45, 45, 45, 0.95);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    border: 1px solid #555;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    max-width: 300px;
}

.download-status.hidden {
    opacity: 0;
    transform: translateY(100px);
}

.download-progress {
    margin-top: 0.5rem;
}

.progress-bar {
    background: #333;
    border-radius: 10px;
    height: 6px;
    overflow: hidden;
}

.progress-fill {
    background: #ff6b35;
    height: 100%;
    transition: width 0.3s ease;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #aaa;
}

.error {
    text-align: center;
    padding: 2rem;
    color: #ff6b6b;
    background: #2d1f1f;
    border-radius: 8px;
    margin: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #aaa;
}

.empty-state h2 {
    color: #ff6b35;
    margin-bottom: 1rem;
}

/* Import Form Styles */
.import-section {
    background: #333333;
    border: 1px solid #555;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

.import-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

input[type="url"] {
    flex: 1;
    background: #3d3d3d;
    color: #ffffff;
    border: 1px solid #555;
    padding: 0.5rem;
    border-radius: 4px;
    min-width: 300px;
}

input[type="url"]:focus {
    outline: none;
    border-color: #ff6b35;
}

input[type="url"]::placeholder {
    color: #888;
}

button {
    background: #ff6b35;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

button:hover {
    background: #e55a2b;
}

button:disabled {
    background: #666;
    cursor: not-allowed;
}

.import-status {
    color: #cccccc;
    font-style: italic;
    margin-top: 0.5rem;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
.spinner {
    border: 2px solid #333;
    border-top: 2px solid #ff6b35;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Mobile layout for controls */
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    select {
        min-width: unset;
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }

    /* Optimize header for mobile */
    .header {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .header-toggle {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        min-width: 100px;
    }

    /* Mobile-friendly comic container */
    .comic-container {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    /* Improve comic page display on mobile */
    .comic-page img {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
    }

    /* Mobile chapter indicator */
    .chapter-indicator {
        font-size: 1rem;
        padding: 0.6rem 1rem;
        border-radius: 6px;
        top: 10px;
        right: 10px;
        /* Ensure it doesn't interfere with mobile browser UI */
        z-index: 200;
    }

    /* Optimize import section for mobile */
    .import-section {
        padding: 0.75rem;
        margin-top: 0.75rem;
    }

    .import-section input[type="url"] {
        padding: 0.75rem;
        font-size: 1rem;
        border-radius: 6px;
    }

    .import-section button {
        padding: 0.75rem 1rem;
        font-size: 1rem;
        border-radius: 6px;
    }

    /* Mobile navigation improvements */
    button, input[type="button"] {
        min-height: 44px; /* Touch-friendly size */
        font-size: 1rem;
    }

    /* Download status on mobile */
    .download-status {
        max-width: 90%;
        margin: 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    /* Small screens - consolidated with very small screen styles */
    .header {
        padding: 0.5rem;
    }

    .header h1 {
        font-size: 1rem; /* Smaller for very small screens */
        margin-bottom: 0.5rem;
    }

    .header-toggle {
        padding: 0.4rem 0.6rem; /* More compact for very small screens */
        font-size: 0.8rem;
        min-width: 70px;
    }

    .comic-container {
        margin: 0.5rem auto;
        padding: 0 0.25rem;
    }

    .chapter-indicator {
        font-size: 0.8rem; /* Smaller for very small screens */
        padding: 0.4rem 0.6rem;
        top: 5px;
        right: 5px;
    }

    /* Compact controls for small screens */
    .controls {
        gap: 0.5rem;
    }

    .control-group {
        gap: 0.3rem;
    }

    select, input {
        padding: 0.5rem; /* More compact for very small screens */
        font-size: 0.85rem;
    }

    /* Chapter dividers on mobile */
    .chapter-divider {
        margin: 1rem 0 0.5rem;
        font-size: 1rem;
    }

    .import-section {
        padding: 0.5rem;
        margin-top: 0.5rem;
    }
}


/* Additional shared styles for home and wrapper pages */
.wrap {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.iframe-container {
    width: 100%;
    height: calc(100vh - 8rem);
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    background: #0d1117;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ripraven-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    z-index: 1;
}

.iframe-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #7d8590;
    font-size: 0.9rem;
    z-index: 0;
}

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

.nav-back a {
    background: #21262d;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid #30363d;
    text-decoration: none;
    font-size: 0.9rem;
    white-space: nowrap;
    color: #e6edf3;
}

.nav-back a:hover {
    background: #30363d;
    text-decoration: none;
}

.page-title {
    font-size: 2.7rem;
    margin: 0;
    color: #e6edf3;
    font-weight: normal;
}