/* ------------------ GENERAL STYLES ------------------ */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
}

h1 {
    text-align: center;
    margin-top: 30px;
}

h2 {
    color: #2c7be5;
    margin-bottom: 20px;
    font-weight: 700;
    font-size: 1.2rem;
    text-align: center;
}

strong {
    color: #1a5bbb;
}

/* ------------------ DOWNLOAD SECTION ------------------ */
.container {
    background: #fff;
    padding: 30px 40px;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    max-width: 90%;
    margin: 30px auto;
    text-align: center;
}

/* ------------------ VIDEO SECTION ------------------ */
.video-section {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.video-section h1 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.video-section h2 {
    color: #2c7be5;
    margin: 30px 0 15px;
    font-size: 1.5rem;
    text-align: center;
}

.intro-text {
    text-align: left;
    font-size: 1rem;
    margin-bottom: 30px;
    color: #555;
}

/* ------------------ VIDEO PLAYER ------------------ */
.main-video-container iframe {
    border-radius: 10px;
    max-width: 80%;
}

/* ------------------ FLEX VIDEO ROW ------------------ */
.flex-video-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 20px;
    margin-top: 20px;
}

.video-card {
    flex: 1 1 30%;
    max-width: 30%;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-card img {
    width: 100%;
    border-radius: 6px;
}

.video-info {
    margin-top: 10px;
    text-align: center;
}

.video-info h3 {
    font-size: 16px;
    color: #333;
    margin: 5px 0;
}

.video-info p {
    font-size: 14px;
    color: #666;
}

/* Hover effect */
.video-card:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ─────────────────────────────────────────────── */
/* 🌟 Custom Video Player Controls Styles */
/* ─────────────────────────────────────────────── */
.video-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.video-controls button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 22px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background-color: #2c7be5;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    min-width: 100px;
    white-space: nowrap;
}

.video-controls button:hover:not(:disabled) {
    background-color: #1a5bbb;
}

.video-controls button:active:not(:disabled) {
    transform: scale(0.97);
}

.video-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.video-controls button i {
    font-size: 1.2em;
    vertical-align: middle;
}

.video-card.active {
    outline: 3px solid #2c7be5;
    border-color: #2c7be5;
    box-shadow: 0 2px 8px rgba(44, 123, 229, 0.5);
}

/* ------------------ VIDEO STATUS ------------------ */
#video-status {
    display: flex;
    align-items: center;
    gap: 15px;
    border-top: 1px solid #ccc;
    line-height: 45px;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-top: 5px;
    overflow-x: auto;
}

/* Inline elements inside video-status */
#video-status > .left,
#video-status > span {
    font-size: 14px;
    color: #333;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 5px;
}

/* Download section styling */
#downloadSection {
    display: inline-flex;
    margin-top: 0;
    align-items: center;
}

/* Button styling */
.btn-download {
    display: inline-block;
    height: 40px;
    width: 100px;
    font-size: 12px;
    background-color: #d00;
    color: white;
    line-height: 40px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
    white-space: nowrap;
}

.btn-download:hover {
    background-color: #ccc;
    color: black;
}

/* Highlight current time and duration */
#video-current,
#video-duration {
    font-weight: 600;
    color: #333;
}

/* Add separator slash after current time */
#video-current::after {
    content: "/";
    margin: 0 0.25rem;
    font-weight: 400;
    color: #666;
}

.externalLink {
    display: block; /* Default kwa simu */
    background-color: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Picha style */
.externalLink .picha img {
    width: 100%;
    max-width: 400px;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Maelezo style */
.externalLink .maelezo {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.6;
    color: #333;
    text-align: left;
}

/* Link ndani ya maelezo */
.externalLink .maelezo a {
    display: inline-block;
    margin-top: 10px;
    color: #007bff;
    text-decoration: none;
    font-weight: bold;
}
img {
      max-width: 100%;    /* Picha isizidi ukubwa wa container */
      height: auto;       /* Ihifadhi uwiano wa picha */
      display: block;     /* Ondoa space chini ya picha (inline gap) */
      border-radius: 8px; /* Ukanda wa pembe za mviringo kidogo */
      object-fit: cover;  /* Ikiwa container ni fixed size, picha ifiche sehemu kubwa */
}
.externalLink .maelezo a:hover {
    text-decoration: underline;
}
.konteina {
    display: flex;
    gap: 20px;
    padding: 20px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background: #f9f9f9;
    align-items: flex-start;
}

.somo {
    flex: 1;
    font-weight: bold;
    font-size: 1.2em;
    color: #333;
}

.maelezo {
    flex: 2;
    font-size: 1em;
    color: #555;
    text-align: left;
}


/* ------------------ RESPONSIVE (TABLET & MOBILE) ------------------ */
@media (max-width: 768px) {
    .flex-video-row {
        flex-direction: column;
    }

    .video-card {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .video-card-inner {
        flex-direction: row;
        align-items: flex-start;
        gap: 15px;
    }

    .video-card img {
        width: 40%;
        max-width: 140px;
        height: auto;
    }

    .video-info {
        text-align: left;
        flex: 1;
    }

    .video-info h3 {
        font-size: 15px;
    }

    .video-info p {
        font-size: 13px;
    }
    .intro-text {
        text-align: left;
    }
    .video-section h1 {
        font-size: 1.2rem;
    }
    .externalLink .picha img {
        width: 100%;
        max-width: 300px;
        height: auto;
        border-radius: 8px;
        display: block;
    }
    
}

/* ------------------ SMALL SCREEN (EXTRA RESPONSIVE) ------------------ */
@media (max-width: 600px) {
    iframe {
        height: 180px;
    }

    .container {
        padding: 20px;
        margin: 20px;
        max-width: 100%;
    }

    .btn-download {
        width: 100%;
        padding: 12px 0;
    }

    h2 {
        font-size: 0.8rem;
        text-align: left;
    }

    .video-section {
        padding: 20px 10px;
        max-width: 100%;
    }

    .video-controls button {
        font-size: 0.9rem;
        padding: 8px 16px;
    }

    #video-status {
        flex-wrap: wrap;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    /* Make the first two spans inline-flex to stay side by side */
    #video-current,
    #video-duration {
        order: 2;
        display: inline-flex;
        white-space: nowrap;
        margin-top: 5px;
        font-size: 13px;
    }

    /* Move the .left div below the spans */
    #video-status > .left {
        order: 1;
        flex-basis: 100%;
        margin-top: 6px;
        font-size: 13px;
    }

    /* Download section at bottom with full width */
    #downloadSection {
        order: 3;
        width: 100%;
        margin-top: 12px;
        justify-content: flex-start;
    }

    /* Shrink button size */
    .btn-download {
        font-size: 12px;
        padding: 0px 14px;
        width: auto;
        max-width: 150px;
    }
    .intro-text {
        text-align: left;
        font-size: 0.8rem;
        
    }
}

/* --- Small Mobile: skrini za chini ya 480px: */
@media only screen and (max-width: 480px) {
    .video-controls {
        margin-top: 16px;
        gap: 8px;
    }
    .video-controls button {
        padding: 8px 14px;
        font-size: 0.9rem;
        min-width: 80px;
        max-height: 40px;
    }
    .video-card-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-info h3, .video-info p {
        font-size: 14px;
        text-align: left;
        width: 100%;
        margin: 0;
    }

    .video-card img {
        width: 100%;
        max-width: none;
        height: auto;
        margin-bottom: 10px;
    }

    #video-status {
        font-size: 0.75rem;
        margin: 5px auto 12px;
    }

    .main-video-container iframe {
        max-width: 100%;
        height: 100%;
    }

    .video-section h1 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    .konteina {
        display: block;
    }

    .somo {
        margin-bottom: 10px;
    }
}

/* --- Ultra small (nano) phones – chini ya 360px: */
@media only screen and (max-width: 360px) {
    .video-card-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .video-info h3, .video-info p {
        font-size: 13px;
        text-align: left;
        width: 100%;
        margin: 0;
    }

    .video-card img {
        width: 100%;
        max-width: none;
        height: auto;
        margin-bottom: 8px;
    }

    .video-controls {
        gap: 6px;
    }

    .video-controls button {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 70px;
        max-height: 36px;
    }
}

/* ------------------ FOOTER ------------------ */
footer {
    text-align: center;
    background: #1a202c;
    color: #cbd5e0;
    padding: 20px;
    margin-top: 50px;
}

/* ------------------ FLEX VIDEO ROW LAYOUT KUANZIA 768px ------------------ */
@media (min-width: 768px) {
    .flex-video-row {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        justify-content: flex-start;
        width: 100%;
        box-sizing: border-box;
    }

    .video-card {
        flex: 1 1 calc(33.333% - 20px);
        max-width: calc(33.333% - 20px);
        box-sizing: border-box;
    }
    .externalLink {
        display: flex;
        align-items: flex-start;
        gap: 20px;
        font-size: 1.2r;
    }

    .externalLink .maelezo {
        text-align: left;
        font-size: 18px;
        margin-top: 0; /* Ondoa margin-top ya simu */
    }
}

