/* Clean Editorial Blue Theme */
@import url('https://fonts.googleapis.com/css2?family=Bowlby+One&family=Space+Mono:wght@400;700&family=Instrument+Serif:ital@0;1&display=swap');

:root {
    --blue: #3841f2;
    --blue-light: #eef0ff;
    --white: #ffffff;
    --off-white: #fafafa;
    --black: #0a0a0a;
    --gray: #71717a;
    --gray-light: #f4f4f5;
    --border: #e4e4e7;

    --font-mono: 'Space Mono', 'Courier New', monospace;
    --font-serif: 'Instrument Serif', Georgia, serif;

    --radius: 20px;
    --radius-sm: 12px;
    --radius-pill: 100px;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-mono);
    background: var(--off-white);
    color: var(--black);
    line-height: 1.5;
    min-height: 100vh;
    padding: 0;
    font-size: 14px;
}

/* Screens */
.screen {
    min-height: 100vh;
    padding: 20px;
}

/* Landing Screen */
.landing-screen {
    background: var(--blue);
}

.landing-screen header h1 {
    color: var(--white);
}

.landing-screen .subtitle {
    color: rgba(255, 255, 255, 0.7);
}

/* Landing screen card - blue triangles for blue background */
.landing-screen .card::before,
.landing-screen .card::after {
    background-image: url('assets/cards/paystub-blue.svg');
}

.container {
    max-width: 700px;
    margin: 0 auto;
}

/* Header */
header {
    text-align: center;
    padding: 60px 0 50px;
    position: relative;
}

header h1 {
    font-family: var(--font-serif);
    font-size: 4rem;
    font-weight: 400;
    color: var(--blue);
    letter-spacing: -2px;
    font-style: italic;
}

.subtitle {
    font-family: var(--font-mono);
    color: var(--gray);
    font-size: 0.85rem;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Card - Receipt Style */
.card {
    background: var(--white);
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 48px 32px;
    margin-bottom: 20px;
    position: relative;
}

.card::before,
.card::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    background-image: url('assets/cards/paystub.svg');
    background-repeat: repeat-x;
    background-size: 12px 6px;
}

.card::before {
    top: 0;
    transform: rotate(180deg);
}

.card::after {
    bottom: 0;
}

/* Card content with dashed borders */
.card-content {
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
    border-image: repeating-linear-gradient(
        90deg,
        #838383 0,
        #838383 2px,
        transparent 4px,
        transparent 8px
    ) 1;
    padding: 30px 0;
}

.card h2 {
    font-family: var(--font-mono);
    font-size: 1.0rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 25px;
    color: var(--black);
}

/* Member Count Badge */
.member-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--blue);
    color: var(--white);
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
}

.member-count:empty {
    display: none;
}

.card h3 {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 30px 0 15px;
    color: var(--gray);
}

/* Blue accent cards */
#results-section {
    background: var(--blue);
    border-left: 1px solid var(--blue);
    border-right: 1px solid var(--blue);
}

#results-section .card-content {
    border-image: repeating-linear-gradient(
        90deg,
        var(--white) 0,
        var(--white) 2px,
        transparent 4px,
        transparent 8px
    ) 1;
}

#results-section h2,
#results-section h3,
#results-section .hint {
    color: var(--white);
}

#results-section .hint {
    opacity: 0.6;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.input-group input {
    flex: 1;
}

/* Form Elements */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--black);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: var(--white);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-light);
}

input::placeholder {
    color: var(--gray);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group > label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    color: var(--black);
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.checkbox-group label:hover {
    border-color: var(--blue);
}

.checkbox-group label:has(input:checked) {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--gray);
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    border: 2px solid var(--black);
    border-radius: var(--radius-pill);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
    color: var(--black);
}

.btn:hover:not(:disabled) {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: #2832d4;
    border-color: #2832d4;
}

.btn-secondary {
    background: var(--gray-light);
    border-color: var(--border);
    color: var(--gray);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--gray);
}

.btn-outline:hover:not(:disabled) {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--white);
}

.btn-danger {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--gray);
    padding: 8px 14px;
    font-size: 0.75rem;
}

.btn-danger:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 10px 16px;
    font-size: 0.75rem;
}

/* Results section button override */
#share-btn {
    background: var(--white);
    border-color: var(--white);
    color: var(--blue);
}

#share-btn:hover:not(:disabled) {
    background: var(--off-white);
    border-color: var(--off-white);
}

/* Members List */
.members-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.members-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border: 2px solid var(--blue);
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    color: var(--blue);
    font-weight: 700;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.2s;
    padding: 4px 8px;
}

.remove-btn:hover {
    color: #dc2626;
}

/* Expenses List */
.expenses-summary {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px dashed var(--border);
}

.expenses-list {
    list-style: none;
}

.expenses-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--gray-light);
}

.expenses-list li:last-child {
    border-bottom: none;
}

.expense-info {
    flex: 1;
}

.expense-description {
    font-weight: 700;
    margin-bottom: 2px;
}

.expense-details {
    font-size: 0.8rem;
    color: var(--gray);
}

.expense-amount {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-style: italic;
    color: var(--blue);
    margin-left: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    margin-top: 15px;
    background: var(--black);
    color: var(--white);
    border-radius: var(--radius-sm);
}

.total-row span:first-child {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.total-row span:last-child {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-style: italic;
}

/* Results */
.results-container {
    margin-top: 25px;
}

.balances-list {
    list-style: none;
}

.balances-list li {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    color: var(--white);
}

.balances-list .positive {
    color: #86efac;
    font-weight: 700;
}

.balances-list .negative {
    color: #fca5a5;
    font-weight: 700;
}

.balances-list .neutral {
    opacity: 0.6;
}

.settlements-list {
    list-style: none;
}

.settlements-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    color: var(--black);
    font-weight: 700;
}

.settlements-list .arrow {
    color: var(--blue);
    font-size: 1.2rem;
}

.settlements-list .amount {
    margin-left: auto;
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-style: italic;
    color: var(--blue);
}

.success-msg {
    text-align: center;
    padding: 25px;
    background: var(--white);
    border-radius: var(--radius-sm);
    color: var(--blue);
    font-weight: 700;
}

/* Hints */
.hint {
    color: var(--gray);
    font-size: 0.8rem;
    padding: 8px 0;
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 30px 0;
    margin-top: 20px;
    border-top: 1px solid var(--border);
}

/* Site Credit Footer */
.site-credit {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 400;
    text-align: center;
    padding: 20px 0 30px;
    color: var(--gray);
    letter-spacing: 1px;
}

.site-credit a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.site-credit a:hover {
    color: var(--blue);
}

.landing-screen .site-credit {
    color: rgba(255, 255, 255, 0.5);
}

.landing-screen .site-credit a:hover {
    color: var(--white);
}

/* Custom Alert System */
.custom-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.custom-alert {
    background: var(--white);
    border-radius: var(--radius);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.2s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.custom-alert-content {
    padding: 30px 24px 20px;
    text-align: center;
}

.custom-alert-content p {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--black);
    line-height: 1.6;
}

.custom-alert-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 24px;
    justify-content: center;
}

.custom-alert-actions .btn {
    min-width: 100px;
}

/* Landing Groups List */
.landing-groups-list {
    list-style: none;
    margin-bottom: 20px;
}

.landing-groups-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    background: var(--black);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.landing-groups-list li:hover {
    background: #1a1a1a;
}

.landing-groups-list .group-info {
    flex: 1;
}

.landing-groups-list .group-name {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-style: italic;
    color: var(--white);
    margin-bottom: 4px;
}

.landing-groups-list .group-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.landing-groups-list .group-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.landing-groups-list .group-details {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 4px;
}

.landing-groups-list .group-members {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--gray);
}

.landing-groups-list .group-total {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-style: italic;
    color: var(--white);
    white-space: nowrap;
}

.landing-groups-list .group-arrow {
    color: var(--white);
    font-size: 1.2rem;
    margin-left: 12px;
}

.landing-groups-list .delete-group-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    font-size: 1rem;
    border-radius: 4px;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.landing-groups-list li:hover .delete-group-btn {
    opacity: 1;
}

.landing-groups-list .delete-group-btn:hover {
    color: #fca5a5;
}

/* Section Divider */
.section-divider {
    height: 1px;
    background: var(--border);
    margin: 30px 0;
}

/* Back Button - Bookmark style */
.back-btn {
    position: fixed;
    left: 0;
    top: 20px;
    background: var(--blue);
    border: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--white);
    cursor: pointer;
    padding: 12px 16px 12px 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: all 0.2s;
    z-index: 100;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
}

.back-btn:hover {
    background: #2832d4;
    padding-left: 16px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    color: var(--black);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--black);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

/* Saved Groups List */
.saved-groups-list {
    list-style: none;
}

.saved-groups-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--gray-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saved-groups-list li:hover {
    background: var(--blue-light);
    border-color: var(--blue);
}

.saved-groups-list .group-info {
    flex: 1;
}

.saved-groups-list .group-name {
    font-weight: 700;
    color: var(--black);
    margin-bottom: 2px;
}

.saved-groups-list .group-members {
    font-size: 0.75rem;
    color: var(--gray);
}

.saved-groups-list .group-actions-btns {
    display: flex;
    gap: 6px;
}

.saved-groups-list .delete-group-btn {
    background: none;
    border: none;
    color: var(--gray);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9rem;
    border-radius: 4px;
}

.saved-groups-list .delete-group-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .screen {
        padding: 12px;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .back-btn {
        top: 12px;
        padding: 10px 14px 10px 10px;
        font-size: 0.7rem;
    }

    .landing-groups-list .delete-group-btn {
        opacity: 1;
    }

    .card {
        padding: 48px 16px;
    }

    .card-content {
        padding: 28px 0;
    }

    .input-group {
        flex-direction: column;
    }

    .expenses-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        position: relative;
        padding-right: 36px;
    }

    .expense-amount {
        margin-left: 0;
    }

    .expenses-list .remove-btn {
        position: absolute;
        top: 16px;
        right: 0;
    }

    .settlements-list li {
        gap: 8px;
        padding: 12px 16px;
        font-size: 0.85rem;
    }

    .settlements-list .arrow {
        font-size: 1rem;
    }

    .settlements-list .amount {
        font-size: 1.1rem;
    }
}

/* Print */
@media print {
    body {
        padding: 0;
    }

    .card {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    #members-section .input-group,
    #expense-form,
    #share-btn,
    footer,
    .remove-btn {
        display: none !important;
    }

    #results-section {
        background: --blue-light;
        color: black;
    }

    #results-section h2,
    #results-section h3 {
        color: black;
    }

    .results-container {
        display: block !important;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}
