/* ============================================================
   CRTC Intervention Downloader - Stylesheet
   Styled to match Canada.ca / CRTC branding
   
   Colours:
     Dark blue (header):  #26374a
     Red (accents):       #b10e1e  (Canada red)
     Light blue (info):   #335075
     White:               #ffffff
     Light grey (bg):     #f5f5f5
     Border grey:         #ddd
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    color: #295376;
    text-decoration: underline;
}

a:hover {
    color: #1a3a52;
}

/* ---- Canada.ca Top Bar ---- */
.canada-bar {
    background-color: #000;
    padding: 4px 0;
}

.canada-bar img {
    height: 28px;
    margin-left: 20px;
}

/* ---- CRTC Header ---- */
.crtc-header {
    background-color: #26374a;
    color: #fff;
    padding: 12px 0;
    border-bottom: 3px solid #b10e1e;
}

.crtc-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.crtc-header .crtc-logo {
    font-size: 13px;
    color: #fff;
    text-decoration: none;
    font-weight: 400;
    line-height: 1.3;
    max-width: 320px;
}

.crtc-header .crtc-logo:hover {
    color: #ddd;
    text-decoration: underline;
}

.crtc-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    flex: 1;
}

/* ---- Breadcrumb ---- */
.breadcrumb-bar {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 8px 0;
}

.breadcrumb-bar .inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    font-size: 14px;
    color: #555;
}

.breadcrumb-bar a {
    color: #295376;
}

.breadcrumb-bar .sep {
    margin: 0 6px;
    color: #999;
}

/* ---- Main Content ---- */
.main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* ---- Page Title ---- */
.page-title {
    font-size: 28px;
    font-weight: 700;
    color: #26374a;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #26374a;
}

/* ---- Info Box ---- */
.info-box {
    background-color: #d8eaf7;
    border-left: 4px solid #335075;
    padding: 16px 20px;
    margin-bottom: 28px;
    border-radius: 0 4px 4px 0;
}

.info-box p {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #1a3a52;
}

.info-box p:last-child {
    margin-bottom: 0;
}

/* ---- Form Card ---- */
.form-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 28px 32px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.form-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #26374a;
    margin: 0 0 20px 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: #333;
    font-size: 15px;
}

.form-group .hint {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.form-group input[type="text"] {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    font-size: 16px;
    border: 2px solid #767676;
    border-radius: 4px;
    color: #333;
    background-color: #fff;
    transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #295376;
    box-shadow: 0 0 0 3px rgba(41, 83, 118, 0.2);
}

.form-group input[type="text"].error {
    border-color: #b10e1e;
}

.field-error {
    color: #b10e1e;
    font-size: 14px;
    margin-top: 6px;
    display: none;
}

.field-error.visible {
    display: block;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, opacity 0.2s;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background-color: #26374a;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1a2a38;
    color: #fff;
    text-decoration: none;
}

.btn-danger {
    background-color: #b10e1e;
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background-color: #8a0b17;
    color: #fff;
    text-decoration: none;
}

.btn-success {
    background-color: #278400;
    color: #fff;
    font-size: 18px;
    padding: 14px 32px;
}

.btn-success:hover:not(:disabled) {
    background-color: #1e6300;
    color: #fff;
    text-decoration: none;
}

.btn-secondary {
    background-color: #eee;
    color: #333;
    border: 1px solid #ccc;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #ddd;
    color: #333;
    text-decoration: none;
}

/* ---- Progress Section ---- */
#progress-section {
    display: none;
}

#progress-section.visible {
    display: block;
}

.progress-card {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 28px 32px;
    margin-bottom: 28px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.progress-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #26374a;
    margin: 0 0 20px 0;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.status-badge.running {
    background-color: #d8eaf7;
    color: #295376;
}

.status-badge.complete {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.error {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.cancelled {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.pending {
    background-color: #e2e3e5;
    color: #383d41;
}

.progress-message {
    font-size: 15px;
    color: #333;
    margin-bottom: 12px;
    min-height: 24px;
}

.progress-bar-container {
    background-color: #e9ecef;
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background-color: #26374a;
    border-radius: 4px;
    transition: width 0.5s ease;
    min-width: 0;
}

.progress-bar-fill.complete {
    background-color: #278400;
}

.progress-bar-fill.error {
    background-color: #b10e1e;
}

.progress-bar-fill.animated {
    background-image: linear-gradient(
        45deg,
        rgba(255,255,255,0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}

.progress-counts {
    font-size: 13px;
    color: #666;
    margin-bottom: 16px;
}

.current-intervener {
    font-size: 14px;
    color: #555;
    font-style: italic;
    margin-bottom: 20px;
    min-height: 20px;
}

.progress-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---- Download Section ---- */
#download-section {
    display: none;
}

#download-section.visible {
    display: block;
}

.download-card {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-left: 4px solid #278400;
    border-radius: 4px;
    padding: 28px 32px;
    margin-bottom: 28px;
}

.download-card h2 {
    font-size: 20px;
    font-weight: 700;
    color: #155724;
    margin: 0 0 12px 0;
}

.download-summary {
    font-size: 15px;
    color: #155724;
    margin-bottom: 20px;
}

.download-summary strong {
    font-weight: 700;
}

/* ---- Error Section ---- */
#error-section {
    display: none;
}

#error-section.visible {
    display: block;
}

.error-card {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-left: 4px solid #b10e1e;
    border-radius: 4px;
    padding: 24px 28px;
    margin-bottom: 28px;
}

.error-card h2 {
    font-size: 18px;
    font-weight: 700;
    color: #721c24;
    margin: 0 0 10px 0;
}

.error-card p {
    color: #721c24;
    margin: 0 0 16px 0;
    font-size: 15px;
}

/* ---- Spinner ---- */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

.spinner.dark {
    border-color: rgba(38,55,74,0.3);
    border-top-color: #26374a;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Footer ---- */
.site-footer {
    background-color: #26374a;
    color: #ccc;
    padding: 20px 0;
    margin-top: 40px;
    font-size: 13px;
}

.site-footer .inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.site-footer a {
    color: #aac8e0;
}

.site-footer a:hover {
    color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .crtc-header h1 {
        font-size: 17px;
    }
    
    .form-card,
    .progress-card,
    .download-card,
    .error-card {
        padding: 20px 16px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .btn-success {
        font-size: 16px;
        padding: 12px 24px;
    }
}
