/* ==========================================================================
   ID Card Scanner Dedicated Page Stylesheet (DocScan)
   ========================================================================== */

/* Page Hero */
.id-page-hero {
    padding: 3.5rem 0 2rem 0;
    text-align: center;
}

.id-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    background: #ffffff;
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}

.id-breadcrumb a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.id-breadcrumb a:hover {
    text-decoration: underline;
}

.id-pill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
}

.id-page-hero h1 {
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-main);
    margin-bottom: 1rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.id-page-hero .hero-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 760px;
    margin: 0 auto 1.5rem auto;
    line-height: 1.65;
}

/* Tool Switcher Banner */
.tool-switcher-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.6rem 1.25rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.tool-switcher-banner a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.tool-switcher-banner a:hover {
    text-decoration: underline;
}

/* Main Studio Workspace Grid */
.id-workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin-bottom: 4rem;
}

@media (max-width: 960px) {
    .id-workspace-grid {
        grid-template-columns: 1fr;
    }
}

/* Studio Left Column: Controls & Slots */
.id-studio-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.75rem;
}

.id-slots-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .id-slots-container {
        grid-template-columns: 1fr;
    }
}

.id-slot-box {
    background: #f8fafc;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    position: relative;
}

.id-slot-box.dragover {
    border-color: var(--primary);
    background: #eff6ff;
}

.id-slot-box.has-image {
    border: 2px solid #22c55e;
    background: #f0fdf4;
}

.id-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.id-slot-header strong {
    font-size: 0.92rem;
    color: var(--text-main);
}

.id-status-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    background: #e2e8f0;
    color: var(--text-muted);
}

.id-status-badge.ready {
    background: #dcfce7;
    color: #15803d;
}

/* Card Preview Box with ID-1 Ratio */
.id-card-viewport {
    width: 100%;
    aspect-ratio: 1.586 / 1; /* ISO/IEC 7810 ID-1 standard */
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

.id-card-viewport img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.id-card-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    gap: 0.35rem;
}

.id-card-placeholder svg {
    color: #94a3b8;
}

.id-slot-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.id-slot-actions .btn-sm {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.45rem 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}

.id-btn-clear {
    color: #ef4444;
    background: none;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.id-btn-clear:hover {
    background: #fee2e2;
}

/* Layout & Option Controls */
.id-options-panel {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

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

.id-options-row:last-child {
    margin-bottom: 0;
}

.id-option-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
}

.id-option-sub {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 400;
}

.id-select {
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    background: #ffffff;
    color: var(--text-main);
    font-weight: 500;
}

.id-filter-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.id-filter-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: #ffffff;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.id-filter-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

.id-filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* Studio Right Column: A4 Live Sheet Preview */
.id-preview-panel {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.75rem;
    position: sticky;
    top: 5rem;
}

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

.id-preview-header h3 {
    font-size: 1.15rem;
    color: var(--text-main);
    margin: 0;
}

.id-sheet-container {
    background: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

#idA4Canvas {
    max-width: 100%;
    height: auto;
    background: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    display: block;
}

.id-export-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.id-export-actions .btn-group-row {
    display: flex;
    gap: 0.75rem;
}

.id-export-actions .btn-group-row button {
    flex: 1;
}

/* Dedicated Camera Viewfinder Modal for ID Capture */
.id-camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.id-camera-modal.hidden {
    display: none;
}

.id-camera-box {
    background: #1e293b;
    border-radius: var(--radius-lg);
    max-width: 720px;
    width: 100%;
    overflow: hidden;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.id-camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.3);
}

.id-camera-view-wrap {
    position: relative;
    width: 100%;
    background: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

#idCameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Aspect Ratio ID Card Overlay Guide */
.id-card-guide-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    aspect-ratio: 1.586 / 1;
    border: 2px dashed rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.75rem;
}

.id-guide-hint {
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-weight: 500;
}

.id-camera-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.3);
}

/* Semantic Content Sections */
.section-id-content {
    padding: 4.5rem 0;
    border-top: 1px solid var(--border-color);
}

.section-id-content:nth-of-type(even) {
    background: var(--bg-subtle);
}

.id-table-wrap {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.id-semantic-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}

.id-semantic-table th, 
.id-semantic-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.id-semantic-table th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--text-main);
}

.id-semantic-table tr:last-child td {
    border-bottom: none;
}

.id-semantic-table td strong {
    color: var(--primary);
}

/* Steps Grid */
.id-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.id-step-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.id-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    border-radius: 9999px;
    margin-bottom: 0.85rem;
}

.id-step-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.id-step-card p {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Internal Linking Cards Grid */
.internal-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.tool-link-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-decoration: none;
    color: inherit;
}

.tool-link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.tool-link-card .tool-badge {
    align-self: flex-start;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #eff6ff;
    color: var(--primary);
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    margin-bottom: 0.85rem;
}

.tool-link-card h3 {
    font-size: 1.2rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.tool-link-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.25rem;
    flex-grow: 1;
}

.tool-link-card .card-action-link {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* ==========================================================================
   Comprehensive Mobile-Friendly Optimization for ID Card Scanner
   ========================================================================== */

@media (max-width: 960px) {
    .id-workspace-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 3rem;
    }

    .id-preview-panel {
        position: static;
        top: auto;
    }
}

@media (max-width: 640px) {
    /* Hero Section on Mobile */
    .id-page-hero {
        padding: 1.75rem 0 1rem 0;
    }

    .id-page-hero h1 {
        font-size: 1.6rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    .id-page-hero .hero-lead {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1.25rem;
    }

    .tool-switcher-banner {
        font-size: 0.82rem;
        padding: 0.6rem 0.9rem;
        line-height: 1.45;
        gap: 0.5rem;
        width: 100%;
        margin-bottom: 1.5rem;
    }

    .id-breadcrumb {
        font-size: 0.8rem;
        padding: 0.25rem 0.7rem;
    }

    /* Studio Card & Slots on Mobile */
    .id-studio-card,
    .id-preview-panel {
        padding: 1.15rem 1rem;
        border-radius: var(--radius-md);
    }

    .id-slots-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        margin-bottom: 1.25rem;
    }

    .id-slot-box {
        padding: 0.85rem;
    }

    .id-slot-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
    }

    .id-slot-actions .btn-sm {
        min-height: 44px; /* Touch friendly tap target */
        font-size: 0.88rem;
        font-weight: 600;
        padding: 0.6rem 0.75rem;
    }

    .id-btn-clear {
        min-height: 44px;
        min-width: 44px;
        font-size: 1.2rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Options & Filter Controls on Mobile */
    .id-options-panel {
        padding: 1rem 0.85rem;
    }

    .id-options-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-bottom: 1.25rem;
    }

    .id-options-row > div:first-child {
        width: 100%;
    }

    .id-select {
        width: 100%;
        min-height: 44px;
        font-size: 0.92rem;
        background-color: #ffffff;
    }

    .id-filter-pills {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .id-filter-btn {
        min-height: 42px;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 0.5rem 0.35rem;
    }

    /* Sheet Canvas & Export Buttons on Mobile */
    .id-sheet-container {
        padding: 0.4rem;
        border-radius: var(--radius-sm);
        margin-bottom: 1rem;
    }

    .id-preview-header h3 {
        font-size: 1.05rem;
    }

    .id-export-actions {
        gap: 0.65rem;
    }

    #btnIdDownloadPdf {
        min-height: 50px;
        font-size: 0.98rem;
        font-weight: 700;
        width: 100%;
    }

    .id-export-actions .btn-group-row {
        display: flex;
        gap: 0.5rem;
    }

    .id-export-actions .btn-group-row button {
        min-height: 44px;
        font-size: 0.85rem;
        font-weight: 600;
    }

    #btnIdOpenEditor {
        min-height: 46px;
        font-size: 0.85rem;
        padding: 0.6rem 0.75rem;
        white-space: normal;
        text-align: center;
        line-height: 1.35;
    }

    /* Fullscreen Mobile Camera Modal */
    .id-camera-modal {
        padding: 0;
        background: #000000;
    }

    .id-camera-box {
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .id-camera-header {
        padding: 0.85rem 1.15rem;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(8px);
        z-index: 10;
    }

    .id-camera-view-wrap {
        flex: 1;
        aspect-ratio: unset;
        height: auto;
        width: 100%;
        position: relative;
    }

    .id-card-guide-overlay {
        width: 90%;
        max-width: 380px;
        border-width: 2.5px;
        border-color: #38bdf8;
        box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
        border-radius: 12px;
    }

    .id-camera-footer {
        padding: 1.25rem 1rem;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(8px);
        z-index: 10;
        display: flex;
        justify-content: space-around;
        align-items: center;
    }

    #btnIdCaptureCamera {
        width: 66px;
        height: 66px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35);
    }

    #btnIdCaptureCamera span {
        display: none;
    }

    #btnIdCaptureCamera svg {
        width: 28px;
        height: 28px;
    }

    #btnIdSwitchCamera {
        min-height: 44px;
        padding: 0.5rem 0.85rem;
        font-size: 0.82rem;
    }

    /* Semantic Content Sections on Mobile */
    .section-id-content {
        padding: 2.75rem 0;
    }

    .section-id-content h2 {
        font-size: 1.45rem !important;
        line-height: 1.35;
    }

    .id-steps-grid,
    .internal-tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .id-step-card,
    .tool-link-card {
        padding: 1.25rem 1rem;
    }

    .id-table-wrap {
        margin: 1.25rem 0;
        -webkit-overflow-scrolling: touch;
    }

    .id-semantic-table th,
    .id-semantic-table td {
        padding: 0.75rem 0.85rem;
        font-size: 0.82rem;
    }
}
