/* ==========================================================
   YouTube Thumbnail Downloader
   Design system matches the existing YouTube Title Generator /
   Title Extractor / Description Extractor: same container,
   colors, radius, shadow, cards, buttons.
   ========================================================== */

.ytd-wrap,
.ytd-wrap *{
    box-sizing:border-box;
    font-family:Arial,sans-serif;
}
.ytd-wrap{
    max-width:1200px;
    width:100%;
    margin:30px auto;
    background:#EEF5FF;
    padding:24px;
    border-radius:12px;
    box-shadow:0 10px 30px rgba(0,0,0,.1);
}
.ytd-wrap h2{
    text-align:center;
    margin:0 0 6px;
    color:#1a3b6b;
}
.ytd-wrap p{
    text-align:center;
    margin-bottom:25px;
    color:#666;
}
.ytd-wrap label{
    display:block;
    font-weight:bold;
    margin:15px 0 6px;
}
.ytd-wrap input{
    width:100%;
    padding:12px;
    border:1px solid #ddd;
    border-radius:8px;
    font-size:15px;
    background:#fff;
}
.ytd-wrap input:focus{
    outline:none;
    border-color:#e62117;
    box-shadow:0 0 0 3px rgba(230,33,23,.12);
}
.ytd-example{
    text-align:left !important;
    font-size:12px;
    color:#999 !important;
    margin:6px 0 0 !important;
}

/* Primary red action button */
.ytd-btn{
    display:inline-block;
    padding:14px 24px;
    background:#e62117;
    color:#fff;
    border:none;
    border-radius:8px;
    font-size:16px;
    font-weight:bold;
    cursor:pointer;
    margin-top:20px;
    transition:background .15s ease, transform .1s ease;
}
.ytd-btn:hover{ background:#c4120f; }
.ytd-btn:active{ transform:scale(.98); }
.ytd-btn:disabled{
    opacity:.6;
    cursor:not-allowed;
    transform:none;
}

/* Loader */
.ytd-loader{
    display:none;
    align-items:center;
    gap:10px;
    margin-top:20px;
    font-weight:bold;
    color:#1a3b6b;
}
.ytd-spinner{
    width:18px;
    height:18px;
    border:3px solid #cdddf5;
    border-top-color:#1a3b6b;
    border-radius:50%;
    display:inline-block;
    animation:ytd-spin .8s linear infinite;
}
@keyframes ytd-spin{
    to{ transform:rotate(360deg); }
}

/* Alerts */
.ytd-alert{
    display:none;
    margin-top:20px;
    padding:14px 16px;
    border-radius:10px;
    font-weight:bold;
    font-size:14px;
}
.ytd-alert-error{
    background:#fdeceb;
    border:1px solid #f3b7b1;
    color:#c4120f;
}
.ytd-alert-success{
    background:#e9f8ec;
    border:1px solid #a9dfb4;
    color:#218838;
}

/* Result section */
.ytd-result{
    margin-top:25px;
    display:none;
    animation:ytd-fade-in .25s ease;
}
@keyframes ytd-fade-in{
    from{ opacity:0; transform:translateY(6px); }
    to{ opacity:1; transform:translateY(0); }
}

.ytd-video-card{
    background:#fff;
    border:1px solid #ddd;
    border-radius:10px;
    padding:16px;
    margin-bottom:20px;
}
.ytd-video-title{
    font-size:17px;
    font-weight:bold;
    color:#1a3b6b;
    line-height:1.4;
    margin-bottom:6px;
}
.ytd-video-sub{
    font-size:13px;
    color:#888;
}

/* Thumbnail grid */
.ytd-thumb-grid{
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(260px, 1fr));
    gap:16px;
}
.ytd-thumb-card{
    background:#fff;
    border:1px solid #ddd;
    border-radius:10px;
    overflow:hidden;
    display:flex;
    flex-direction:column;
}
.ytd-thumb-img-wrap{
    background:#eee;
    aspect-ratio:16/9;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
}
.ytd-thumb-img-wrap img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}
.ytd-thumb-info{
    padding:12px 14px;
    display:flex;
    flex-direction:column;
    gap:8px;
    flex:1;
}
.ytd-thumb-label{
    font-weight:bold;
    color:#1a3b6b;
    font-size:14px;
}
.ytd-thumb-dims{
    font-size:12px;
    color:#888;
}
.ytd-thumb-btn-row{
    margin-top:auto;
    display:flex;
    gap:8px;
}
.ytd-thumb-download,
.ytd-thumb-copy{
    flex:1;
    border:none;
    padding:10px 12px;
    border-radius:8px;
    font-weight:bold;
    font-size:13px;
    cursor:pointer;
    text-align:center;
    text-decoration:none;
    display:inline-block;
    transition:background .2s ease;
}
.ytd-thumb-download{
    background:#1a3b6b;
    color:#fff;
}
.ytd-thumb-download:hover{ background:#12294d; color:#fff; }

.ytd-thumb-copy{
    background:#28a745;
    color:#fff;
}
.ytd-thumb-copy:hover{ background:#218838; }
.ytd-thumb-copy.copied{ background:#1a7a37; }

/* Action buttons row */
.ytd-actions{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
    margin-top:20px;
}
.ytd-action-btn{
    border:none;
    padding:12px 20px;
    border-radius:8px;
    cursor:pointer;
    font-weight:bold;
    font-size:14px;
    color:#fff;
    transition:background .2s ease;
}
.ytd-copy-btn{ background:#28a745; }
.ytd-copy-btn:hover{ background:#218838; }
.ytd-copy-btn.copied{ background:#1a7a37; }

.ytd-clear-btn{ background:#888; }
.ytd-clear-btn:hover{ background:#666; }

/* Responsive */
@media (max-width:640px){
    .ytd-thumb-grid{ grid-template-columns:1fr; }
    .ytd-actions{ flex-direction:column; }
    .ytd-action-btn{ width:100%; text-align:center; }
}
