/*
================================
MOBILE FIRST STYLES
================================
*/
:root {
    --primary-color: #007AFF;
    --primary-hover-color: #005ecb;
    --secondary-color: #4cd964;
    --secondary-hover-color: #3bb54f;
    --background-color: #f8f9fa;
    --text-color: #1c1c1e;
    --header-bg: rgba(255, 255, 255, 0.85);
    --border-color: #d1d1d6;
    --shadow-color: rgba(0, 0, 0, 0.08);
}

/* --- General --- */
body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

/* --- index.html --- */
.container.index-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /*height: 85vh;*/
    text-align: center;
    padding: 15px;
}

.content h1 {
    font-size: clamp(1.8rem, 7vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.template-btn-wrap {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    margin-top: 2rem;
    width: 100%;
}

.template-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    max-width: 500px;
    box-sizing: border-box;
    background-color: var(--primary-color);
    color: #fff;
    padding: 16px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.2);
    text-align: center;
}

.template-btn:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

.template-btn.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    box-shadow: none;
}

.template-btn.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.3);
}

/* Icons using CSS mask */
.icon {
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    background-color: currentColor;
    mask-repeat: no-repeat;
    mask-size: contain;
    mask-position: center;
}

.icon-manual {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M21.92,7.62A1,1,0,0,0,21,7H3a1,1,0,0,0-.92.62,1,1,0,0,0,.21,1.09l9,11a1,1,0,0,0,1.42,0l9-11A1,1,0,0,0,21.92,7.62ZM12,17.67,4.88,9H19.12Z"/></svg>');
}

.icon-video {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M21,7.4a2,2,0,0,0-2-2H5a2,2,0,0,0-2,2V16.6a2,2,0,0,0,2,2h7.25a.76.76,0,0,0,.75-.75V16.1a.76.76,0,0,0-.75-.75H5V7.4h14ZM16.3,17.8,19,16.1v-1.9l-2.7,1.7Z" opacity=".3"/><path d="M21.7,8.2a.74.74,0,0,0-1,.1L18,10.4V9a1,1,0,0,0-1-1H5A1,1,0,0,0,4,9v8a1,1,0,0,0,1,1H17a1,1,0,0,0,1-1V13.6l2.7,2.1a.76.76,0,0,0,.7.1.75.75,0,0,0,.3-.6V8.8A.75.75,0,0,0,21.7,8.2ZM17,15.9V9.1h.1l2.6-2.1v6.8l-2.6-2.1Z"/></svg>');
}

.icon-help {
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12,2A10,10,0,1,0,22,12,10,10,0,0,0,12,2Zm0,18a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z"/><path d="M12,6.42a2.38,2.38,0,0,0-2.38,2.38,1,1,0,0,0,2,0A.38.38,0,0,1,12,8.42a.38.38,0,0,1,.38.38.37.37,0,0,1-.38.37,1,1,0,0,0-1,1v1.17a1,1,0,1,0,2,0V10.5a2.38,2.38,0,0,0-.38-1.19A2.36,2.36,0,0,0,12,6.42Z"/><circle cx="12" cy="15.5" r="1.25"/></svg>');
}

.btn-secondary .icon {
    background-color: var(--primary-color);
}

.btn-secondary:hover .icon {
    background-color: white;
}

/* --- image.html --- */
body.image-viewer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px 15px;
    box-shadow: 0 1px 2px var(--shadow-color);
    z-index: 1000;
    flex-shrink: 0;
    border-radius: 8px;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.header .title {
    font-size: 1.1rem;
    font-weight: 700;
}

#languageSelect {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    font-size: 0.85rem;
    max-width: 130px;
}

.header-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.navigation {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(0,0,0,0.05);
    padding: 4px;
    border-radius: 8px;
}

.btn {
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 12px;
    transition: all 0.2s ease;
    background-color: var(--primary-color);
    color: white;
}

.download-btn {
    background-color: var(--secondary-color);
}

.btn:disabled {
    background-color: #c8c8cd;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.9rem;
    color: var(--text-color);
    min-width: 50px;
    text-align: center;
    font-weight: 500;
}

.image-container {
    flex-grow: 1;
    overflow-y: auto;
    background: #e9ecef;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    box-sizing: border-box;
}

.page-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto 15px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 8px;
}

.loading {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    font-size: 1rem;
    font-weight: 500;
}

/*
================================
TABLET & DESKTOP STYLES
================================
*/
@media (min-width: 601px) {
    /* --- General --- */
    .container {
        max-width: 800px;
    }

    /* --- index.html --- */
    .template-btn {
        padding: 16px 32px;
        font-size: 1.1rem;
    }

    /* --- image.html --- */
    .header {
        padding: 12px 20px;
    }

    .header-top {
        margin-bottom: 12px;
    }

    .header .title {
        font-size: 1.25rem;
    }

    #languageSelect {
        padding: 8px 12px;
        font-size: 0.9rem;
        max-width: 180px;
    }

    .header-bottom {
        justify-content: center;
        gap: 15px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .page-info {
        font-size: 1rem;
        min-width: 60px;
    }
}
