/* Calendar link (owner 2026-12-03): the popup behind the Tasks page's
   "Calendar link" button. Dark is the default; every light rule is explicit
   under [data-theme="light"] with literal colours (the light theme defines
   no variables - same pattern as rule-of-one.css). */

.cal-link-modal {
    display: none;
    position: fixed;
    z-index: 1050; /* above the nav bar, below the in-page popups */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}
.cal-link-modal.open { display: block; }
.cal-link-box {
    box-sizing: border-box;
    background-color: #333;
    color: #ddd;
    margin: 5vh auto;
    padding: 24px;
    border-radius: 10px;
    width: 92%;
    max-width: 640px;
    font-size: 14px;
    line-height: 1.5;
    text-align: left;
}
.cal-link-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.cal-link-header h3 {
    margin: 0;
    color: #fff;
    font-size: 20px;
}
.cal-link-close {
    background: none;
    border: none;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.cal-link-close:hover { color: #fff; }
.cal-link-intro { margin: 0 0 16px 0; }
.cal-link-error {
    margin: 0 0 12px 0;
    color: #ff8a80;
}
.cal-link-label {
    display: block;
    margin: 0 0 6px 0;
    color: #aaa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.cal-link-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.cal-link-url {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #555;
    border-radius: 6px;
    background-color: #222;
    color: #fff;
    font-family: Consolas, Menlo, monospace;
    font-size: 12px;
}
.cal-link-url:focus { outline: none; border-color: #4CAF50; }
.cal-link-btn {
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.cal-link-btn:disabled { opacity: 0.5; cursor: default; }
.cal-link-btn-primary { background: #4CAF50; color: #fff; }
.cal-link-btn-primary:hover:not(:disabled) { background: #45a049; }
.cal-link-btn-secondary {
    background: transparent;
    color: #ccc;
    border: 1px solid #666;
}
.cal-link-btn-secondary:hover:not(:disabled) { border-color: #999; color: #fff; }
.cal-link-btn-danger {
    background: transparent;
    color: #ff8a80;
    border: 1px solid #b3554d;
}
.cal-link-btn-danger:hover:not(:disabled) { background: rgba(220, 53, 69, 0.18); color: #fff; }
.cal-link-status {
    margin: 8px 0 0 0;
    color: #999;
    font-size: 12px;
}
.cal-link-section {
    margin: 20px 0 8px 0;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
}
.cal-link-app {
    border: 1px solid #444;
    border-radius: 6px;
    margin-bottom: 6px;
    background: #2c2c2c;
}
.cal-link-app summary {
    cursor: pointer;
    padding: 9px 12px;
    color: #eee;
    font-weight: bold;
}
.cal-link-app ol {
    margin: 0;
    padding: 0 12px 12px 34px;
}
.cal-link-app li { margin: 4px 0; }
.cal-link-notes {
    margin: 0;
    padding-left: 20px;
}
.cal-link-notes li { margin: 4px 0; }
.cal-link-private {
    margin: 16px 0 0 0;
    padding: 12px 14px;
    border: 1px solid #6b4a1e;
    border-radius: 6px;
    background: rgba(255, 193, 7, 0.08);
    color: #e6d3a3;
}
.cal-link-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}
@media (max-width: 480px) {
    .cal-link-row { flex-direction: column; }
}

/* ---------------- light theme ---------------- */

[data-theme="light"] .cal-link-box { background-color: #ffffff; color: #374151; }
[data-theme="light"] .cal-link-header h3 { color: #111827; }
[data-theme="light"] .cal-link-close { color: #6b7280; }
[data-theme="light"] .cal-link-close:hover { color: #111827; }
[data-theme="light"] .cal-link-error { color: #b91c1c; }
[data-theme="light"] .cal-link-label { color: #6b7280; }
/* theme.css paints text inputs light-grey !important - this must win. */
[data-theme="light"] .cal-link-modal .cal-link-url {
    background-color: #f9fafb !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
}
[data-theme="light"] .cal-link-modal .cal-link-url:focus { border-color: #4CAF50 !important; }
[data-theme="light"] .cal-link-btn-secondary { color: #4b5563; border-color: #d1d5db; }
[data-theme="light"] .cal-link-btn-secondary:hover:not(:disabled) { border-color: #9ca3af; color: #111827; }
[data-theme="light"] .cal-link-btn-danger { color: #b91c1c; border-color: #f0b4b4; }
[data-theme="light"] .cal-link-btn-danger:hover:not(:disabled) { background: #fef2f2; color: #991b1b; }
[data-theme="light"] .cal-link-status { color: #6b7280; }
[data-theme="light"] .cal-link-section { color: #111827; }
[data-theme="light"] .cal-link-app { border-color: #e5e7eb; background: #f9fafb; }
[data-theme="light"] .cal-link-app summary { color: #111827; }
[data-theme="light"] .cal-link-private {
    border-color: #f5d990;
    background: #fffbeb;
    color: #78510f;
}
