/* ============================================================
   JiraRust — Modern Project Management UI
   ============================================================ */

/* --- CSS Variables / Theme -------------------------------- */
:root {
    --jg-primary: #0052cc;
    --jg-primary-hover: #0747a6;
    --jg-primary-light: #deebff;
    --jg-accent: #6554c0;
    --jg-success: #36b37e;
    --jg-warning: #ffab00;
    --jg-danger: #ff5630;
    --jg-bg: #f4f5f7;
    --jg-surface: #ffffff;
    --jg-text: #172b4d;
    --jg-text-muted: #6b778c;
    --jg-border: #dfe1e6;
    --jg-shadow: 0 1px 3px rgba(23,43,77,0.12), 0 0 1px rgba(23,43,77,0.16);
    --jg-shadow-lg: 0 8px 24px rgba(23,43,77,0.14), 0 0 1px rgba(23,43,77,0.18);
    --jg-radius: 8px;
    --jg-radius-lg: 12px;
    --jg-gradient: linear-gradient(135deg, #0052cc 0%, #6554c0 100%);
    --jg-gradient-warm: linear-gradient(135deg, #6554c0 0%, #ff5630 100%);
    --jg-rust-charcoal: #1f1b1a;
    --jg-rust-oxide: #c4552d;
    --jg-rust-ember: #e07a3f;
    --jg-rust-smoke: #f4e8dc;
}

/* --- Base ------------------------------------------------- */
body {
    background-color: var(--jg-bg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Ubuntu, "Helvetica Neue", sans-serif;
    color: var(--jg-text);
    line-height: 1.6;
}

a {
    color: var(--jg-primary);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover {
    color: var(--jg-primary-hover);
}

/* --- Auth Pages (Login / Register) ------------------------ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 18% 18%, rgba(224,122,63,0.28) 0%, rgba(224,122,63,0) 38%),
                linear-gradient(135deg, #1b1716 0%, #2f221d 48%, #4c2d22 100%);
    position: relative;
    overflow: hidden;
}
.auth-page::before {
    content: "";
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(224,122,63,0.12);
}
.auth-page::after {
    content: "";
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(196,85,45,0.16);
}

.auth-card {
    background: linear-gradient(180deg, #fffaf4 0%, #fff6ee 100%);
    border-radius: var(--jg-radius-lg);
    border: 1px solid rgba(196,85,45,0.26);
    box-shadow: 0 16px 36px rgba(20,15,14,0.34), 0 1px 0 rgba(255,255,255,0.32) inset;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    position: relative;
    z-index: 1;
    animation: fadeSlideUp 0.4s ease-out;
}

.auth-logo {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #70341f 0%, #c4552d 52%, #e07a3f 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--jg-text-muted);
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
}

.auth-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--jg-text);
    margin-bottom: 0.35rem;
}

.auth-card .form-control {
    border-radius: var(--jg-radius);
    border: 2px solid var(--jg-border);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-card .form-control:focus {
    border-color: var(--jg-rust-oxide);
    box-shadow: 0 0 0 3px rgba(196,85,45,0.18);
}

.auth-card .btn-primary,
.auth-card .btn-success {
    border-radius: var(--jg-radius);
    padding: 0.65rem 1rem;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    transition: transform 0.15s, box-shadow 0.2s;
}
.auth-card .btn-primary {
    background: linear-gradient(135deg, #a64624 0%, #c4552d 55%, #e07a3f 100%);
}
.auth-card .btn-success {
    background: linear-gradient(135deg, var(--jg-success) 0%, #00875a 100%);
}
.auth-card .btn-primary:hover,
.auth-card .btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(42,22,16,0.35);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--jg-text-muted);
    font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--jg-border);
}
.auth-divider::before { margin-right: 1rem; }
.auth-divider::after  { margin-left: 1rem; }

.auth-footer {
    text-align: center;
    font-size: 0.9rem;
    color: var(--jg-text-muted);
}
.auth-footer a {
    font-weight: 600;
}

/* Input icon wrapper */
.input-icon-wrap {
    position: relative;
}
.input-icon-wrap .form-control {
    padding-left: 2.5rem;
}
.input-icon-wrap .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--jg-text-muted);
    font-size: 1rem;
    pointer-events: none;
}

/* --- Navbar ----------------------------------------------- */
.navbar-jg {
    background: linear-gradient(110deg, var(--jg-rust-charcoal) 0%, #2a2321 52%, #4a2d22 100%) !important;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(224,122,63,0.45);
    box-shadow: 0 3px 10px rgba(31,27,26,0.45), inset 0 -1px 0 rgba(255,255,255,0.08);
    --bs-navbar-toggler-border-color: rgba(244,232,220,0.3);
    --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28244, 232, 220, 0.95%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.navbar-jg .navbar-brand {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--jg-rust-smoke) !important;
    text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
.navbar-jg .nav-link {
    color: rgba(244,232,220,0.9) !important;
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: 999px;
    padding: 0.4rem 0.75rem !important;
    transition: background 0.15s, color 0.15s, transform 0.15s;
}
.navbar-jg .nav-link:hover {
    background: rgba(224,122,63,0.18);
    color: #fff !important;
    transform: translateY(-1px);
}
.navbar-jg .user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--jg-rust-smoke);
    font-size: 0.85rem;
}
.navbar-jg .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--jg-rust-oxide) 0%, var(--jg-rust-ember) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

/* --- Page Header ------------------------------------------ */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--jg-border);
}
.page-header h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin: 0;
}

/* --- Cards ------------------------------------------------ */
.card-jg {
    background: var(--jg-surface);
    border: 1px solid var(--jg-border);
    border-radius: var(--jg-radius-lg);
    box-shadow: var(--jg-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}
.card-jg:hover {
    transform: translateY(-3px);
    box-shadow: var(--jg-shadow-lg);
}

/* --- Project Cards ---------------------------------------- */
.project-card {
    border: 1px solid var(--jg-border);
    border-radius: var(--jg-radius-lg);
    box-shadow: var(--jg-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.project-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--jg-shadow-lg);
    border-color: var(--jg-primary);
}
.project-card .card-body {
    padding: 1.25rem;
}
.project-card .project-key {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: var(--jg-primary-light);
    color: var(--jg-primary);
}
.project-card .card-footer {
    background: #fafbfc;
    border-top: 1px solid var(--jg-border);
    padding: 0.75rem 1.25rem;
}

/* --- Kanban Board ----------------------------------------- */
.board-column {
    min-height: 500px;
    background-color: #f0f1f4;
    border: none;
    border-radius: var(--jg-radius-lg) !important;
    overflow: hidden;
}
.board-column .card-header {
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.65rem 1rem;
}
.board-column-body {
    max-height: 600px;
    overflow-y: auto;
    padding: 0.5rem;
    transition: background-color 0.15s, box-shadow 0.15s;
}
.board-column-body.drop-target {
    background: #e6edf8;
    box-shadow: inset 0 0 0 2px rgba(242, 157, 74, 0.45);
    border-radius: calc(var(--jg-radius) - 2px);
}

/* --- Issue Cards ------------------------------------------ */
.issue-card {
    border: 1px solid var(--jg-border);
    border-left: 4px solid var(--jg-primary);
    border-radius: var(--jg-radius) !important;
    cursor: pointer;
    transition: border-color 0.15s;
    background: var(--jg-surface);
}
.issue-card:hover {
    box-shadow: var(--jg-shadow) !important;
    transform: none;
}
.issue-card .card-body {
    padding: 0.6rem 0.75rem;
}
.issue-card.priority-critical { border-left-color: var(--jg-danger); }
.issue-card.priority-high     { border-left-color: var(--jg-warning); }
.issue-card.priority-medium   { border-left-color: var(--jg-primary); }
.issue-card.priority-low      { border-left-color: var(--jg-text-muted); }

.issue-card-link {
    color: inherit;
    transition: none;
    cursor: grab;
}
.issue-card-link:hover {
    color: inherit;
}
.issue-card-link:active {
    cursor: grabbing;
}
.issue-card-link.dragging {
    opacity: 0.6;
}
.issue-card-link.dragging .issue-card {
    box-shadow: var(--jg-shadow-lg) !important;
}

/* --- Issue Detail ----------------------------------------- */
.issue-detail-header {
    background: var(--jg-surface);
    border-radius: var(--jg-radius-lg);
    border: 1px solid var(--jg-border);
    box-shadow: var(--jg-shadow);
    padding: 1.5rem;
}
.issue-key-badge {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.3rem 0.7rem;
    border-radius: 6px;
    background: var(--jg-primary-light);
    color: var(--jg-primary);
}

/* --- Badge Overrides -------------------------------------- */
.badge {
    font-weight: 600;
    letter-spacing: 0.3px;
    font-size: 0.75rem;
}
.badge-priority-critical { background: var(--jg-danger) !important; }
.badge-priority-high     { background: var(--jg-warning) !important; color: #172b4d !important; }
.badge-priority-medium   { background: var(--jg-primary) !important; }
.badge-priority-low      { background: #dfe1e6 !important; color: var(--jg-text) !important; }

.badge-status-todo        { background: #dfe1e6 !important; color: var(--jg-text) !important; }
.badge-status-in_progress { background: var(--jg-primary) !important; }
.badge-status-in_review   { background: var(--jg-warning) !important; color: #172b4d !important; }
.badge-status-done        { background: var(--jg-success) !important; }

/* --- Buttons ---------------------------------------------- */
.btn-jg {
    border-radius: var(--jg-radius);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.5rem 1.25rem;
    transition: transform 0.15s, box-shadow 0.2s;
}
.btn-jg:hover {
    transform: translateY(-1px);
}
.btn-jg-primary {
    background: var(--jg-gradient);
    color: #fff;
    border: none;
}
.btn-jg-primary:hover {
    box-shadow: 0 4px 12px rgba(0,82,204,0.3);
    color: #fff;
}

/* --- User Table ------------------------------------------- */
.table-jg {
    border-collapse: separate;
    border-spacing: 0;
}
.table-jg thead th {
    background: #fafbfc;
    border-bottom: 2px solid var(--jg-border);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--jg-text-muted);
    padding: 0.75rem 1rem;
}
.table-jg tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--jg-border);
}
.table-jg tbody tr:hover {
    background: var(--jg-primary-light);
}
.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--jg-gradient);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    margin-right: 0.5rem;
}

/* --- Sprint Badges ---------------------------------------- */
.sprint-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- Empty States ----------------------------------------- */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}
.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}
.empty-state h4 {
    font-weight: 700;
    color: var(--jg-text);
}
.empty-state p {
    color: var(--jg-text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* --- Comment Section -------------------------------------- */
.comment-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--jg-border);
}
.comment-item:last-child {
    border-bottom: none;
}
.comment-author {
    font-weight: 700;
    font-size: 0.9rem;
}
.comment-time {
    color: var(--jg-text-muted);
    font-size: 0.8rem;
}

/* --- Alert ------------------------------------------------ */
.alert {
    border-radius: var(--jg-radius);
    font-size: 0.9rem;
    border: none;
}
.alert-danger {
    background: #ffebe6;
    color: #bf2600;
}
.alert-success {
    background: #e3fcef;
    color: #006644;
}

/* --- Modals ----------------------------------------------- */
.modal-content {
    border-radius: var(--jg-radius-lg);
    border: none;
    box-shadow: var(--jg-shadow-lg);
}
.modal-header {
    border-bottom: 1px solid var(--jg-border);
    padding: 1.25rem 1.5rem;
}
.modal-body {
    padding: 1.5rem;
}
.modal-footer {
    border-top: 1px solid var(--jg-border);
    padding: 1rem 1.5rem;
}

/* --- Scrollbar -------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #c1c7d0;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #97a0af;
}

/* --- Animations ------------------------------------------- */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeSlideUp 0.3s ease-out;
}

/* --- Utilities -------------------------------------------- */
code {
    font-size: 0.75rem;
    user-select: all;
    background: #f4f5f7;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: var(--jg-text);
}

.text-gradient {
    background: var(--jg-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Dashboard Stats -------------------------------------- */
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
