/* ============================================
   modern-theme.css - Atlassian Design System
   Modern Trello (2025-2026) Design Tokens & Shared Styles
   ============================================ */

/* ── Design Tokens ── */
:root {
    /* Surfaces */
    --ds-surface: #FFFFFF;
    --ds-surface-sunken: #F7F8F9;
    --ds-surface-hovered: #F0F1F2;
    --ds-surface-pressed: #DDDEE1;
    --ds-surface-overlay: #FFFFFF;

    /* Text */
    --ds-text: #172B4D;
    --ds-text-subtle: #626f86;
    --ds-text-subtlest: #6b778c;
    --ds-text-inverse: #FFFFFF;
    --ds-text-link: #0c66e4;

    /* Borders */
    --ds-border: #091e4224;
    --ds-border-input: #dfe1e6;
    --ds-border-focused: #0079bf;

    /* Backgrounds */
    --ds-background-brand: #0079bf;
    --ds-background-brand-hovered: #026aa7;
    --ds-background-danger: #eb5a46;
    --ds-background-danger-hovered: #cf513d;
    --ds-background-success: #61bd4f;
    --ds-background-warning: #ff991a;
    --ds-background-neutral: #091e420a;
    --ds-background-selected: #E9F2FF;

    /* Shadows (Atlassian elevation) */
    --ds-shadow-raised: 0px 1px 1px #1e1f2140, 0px 0px 1px #1e1f214f;
    --ds-shadow-overlay: 0px 8px 12px #1e1f2126, 0px 0px 1px #1e1f214f;
    --ds-shadow-card-hover: 0px 4px 8px #1e1f2126, 0px 0px 1px #1e1f214f;

    /* Border Radius */
    --ds-radius-card: 8px;
    --ds-radius-list: 12px;
    --ds-radius-button: 4px;
    --ds-radius-modal: 12px;
    --ds-radius-input: 4px;
    --ds-radius-badge: 4px;
    --ds-radius-sidebar-item: 6px;

    /* Typography */
    --ds-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    --ds-font-size-body: 14px;
    --ds-font-size-small: 12px;
    --ds-font-size-heading-l: 24px;
    --ds-font-size-heading-m: 20px;
    --ds-font-size-heading-s: 16px;

    /* Spacing */
    --ds-space-050: 4px;
    --ds-space-100: 8px;
    --ds-space-150: 12px;
    --ds-space-200: 16px;
    --ds-space-300: 24px;
    --ds-space-400: 32px;

    /* Transitions */
    --ds-transition: all 0.2s ease;
}

/* ── Reset ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--ds-font-family);
    color: var(--ds-text);
    font-size: var(--ds-font-size-body);
    line-height: 1.43;
}

/* ── Animations ── */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Loading Screen ── */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0079bf 0%, #026aa7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease-out;
}

.loading-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: var(--ds-radius-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 40px;
    color: #0079bf;
    margin: 0 auto 20px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

/* ── Navbar ── */
.navbar {
    background: #026aa7;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 0 rgba(9, 30, 66, 0.13);
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-size: 14px;
}

.navbar h1 {
    color: white;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo {
    width: 30px;
    height: 30px;
    background: white;
    border-radius: var(--ds-radius-button);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #0079bf;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--ds-radius-button);
    transition: background 0.2s;
    font-size: 14px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── View Toggle ── */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--ds-radius-button);
    padding: 4px;
}

.view-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    border-radius: var(--ds-radius-button);
    font-size: 14px;
    transition: var(--ds-transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.view-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.view-btn.active {
    background: white;
    color: #0079bf;
}

/* ── User Avatar (navbar) ── */
.current-user {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: var(--ds-radius-button);
    cursor: pointer;
    transition: var(--ds-transition);
}

.current-user:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: white;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: var(--ds-radius-button);
    cursor: pointer;
    font-size: 14px;
    transition: var(--ds-transition);
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ── Buttons ── */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--ds-radius-button);
    font-size: 14px;
    cursor: pointer;
    transition: var(--ds-transition);
    font-weight: 500;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--ds-background-brand);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--ds-background-brand-hovered);
    transform: translateY(-1px);
    box-shadow: var(--ds-shadow-raised);
}

.btn-primary:disabled {
    background: var(--ds-background-neutral);
    color: #a5adba;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-danger {
    background: var(--ds-background-danger);
    color: white;
}

.btn-danger:hover {
    background: var(--ds-background-danger-hovered);
}

.btn-cancel {
    background: transparent;
    color: var(--ds-text-subtlest);
    border: 1px solid var(--ds-border-input);
    padding: 8px 16px;
    border-radius: var(--ds-radius-button);
    font-size: 14px;
    cursor: pointer;
    transition: var(--ds-transition);
    font-weight: 500;
}

.btn-cancel:hover {
    background: var(--ds-surface-sunken);
    border-color: #c1c7d0;
    color: var(--ds-text);
}

/* ── Form Inputs ── */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--ds-text-subtle);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--ds-border-input);
    border-radius: var(--ds-radius-input);
    font-size: 14px;
    font-family: inherit;
    transition: var(--ds-transition);
    background: var(--ds-surface);
}

.form-input:focus {
    outline: none;
    border-color: var(--ds-border-focused);
    box-shadow: 0 0 0 1px var(--ds-border-focused);
}

.form-input.error {
    border-color: var(--ds-background-danger);
}

.form-input.success {
    border-color: var(--ds-background-success);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Modals ── */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--ds-surface);
    border-radius: var(--ds-radius-modal);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e4e6ea;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: var(--ds-font-size-heading-m);
    font-weight: 600;
    color: var(--ds-text);
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: var(--ds-text-subtlest);
    padding: 4px 8px;
    border-radius: var(--ds-radius-button);
    transition: var(--ds-transition);
}

.modal-close:hover {
    background: var(--ds-surface-hovered);
    color: var(--ds-text);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e4e6ea;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Avatars ── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.member-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.2s;
}

.member-avatar:hover {
    transform: translateY(-2px);
    z-index: 1;
}

/* ── Badges ── */
.badge {
    padding: 4px 8px;
    border-radius: var(--ds-radius-badge);
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-admin {
    background: var(--ds-background-warning);
    color: white;
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--ds-radius-button);
    margin-bottom: 20px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.alert-error {
    background: #ffeae8;
    color: #c9372c;
    border: 1px solid #f5c6c0;
}

.alert-success {
    background: #e3fcef;
    color: #216e4e;
    border: 1px solid #abe2d5;
}

/* ── Error/Success Messages ── */
.error-message {
    color: var(--ds-background-danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--ds-background-success);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.success-message.show {
    display: block;
}

/* ── Tags ── */
.tag {
    padding: 2px 8px;
    border-radius: var(--ds-radius-badge);
    font-size: 12px;
    font-weight: 500;
}

/* ── Card Info (Calendar/Table modals) ── */
.card-info {
    margin-bottom: 16px;
}

.card-info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ds-text-subtle);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.card-info-value {
    font-size: 14px;
    color: var(--ds-text);
}

.card-description {
    background: var(--ds-surface-sunken);
    padding: 12px;
    border-radius: var(--ds-radius-card);
    font-size: 14px;
    line-height: 1.5;
    color: var(--ds-text);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--ds-text-subtle);
}

.empty-state h3 {
    font-size: 20px;
    color: var(--ds-text);
    margin-bottom: 8px;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid var(--ds-border-input);
    background: white;
    border-radius: var(--ds-radius-button);
    cursor: pointer;
    transition: var(--ds-transition);
    font-size: 14px;
    color: var(--ds-text-subtle);
}

.page-btn:hover:not(:disabled) {
    border-color: var(--ds-border-focused);
    color: var(--ds-border-focused);
}

.page-btn.active {
    background: var(--ds-background-brand);
    color: white;
    border-color: var(--ds-background-brand);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: var(--ds-text-subtle);
    font-size: 14px;
    margin: 0 8px;
}

/* ── Labels ── */
.label {
    height: 8px;
    width: 40px;
    border-radius: 4px;
    display: inline-block;
}

.label-green { background: #61bd4f; }
.label-yellow { background: #f2d600; }
.label-red { background: #eb5a46; }
.label-blue { background: #0079bf; }
.label-purple { background: #c377e0; }

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* ── Responsive (shared breakpoints) ── */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .view-toggle {
        display: none;
    }
}
