/* Font Face Declarations */
@font-face {
    font-family: 'Berkeley Mono';
    src: url('/static/fonts/BerkeleyMonoVariable-Regular.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Berkeley Mono', -apple-system, monospace;
    line-height: 1.4;
    color: #000;
    background: #fafafa;
    min-height: 100vh;
    font-size: 14px;
    font-weight: 700;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    position: relative;
}

header h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 16px;
    color: #000;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    border: 3px solid #000;
    background: #fff;
    padding: 20px;
    box-shadow: 4px 4px 0px 0px #000;
    transform: rotate(-1deg);
    display: inline-block;
}

header p {
    font-size: 1rem;
    color: #666;
    font-weight: 400;
}

/* Main content */
main {
    background: #fff;
    border: 2px solid #000;
    padding: 40px;
    box-shadow: 6px 6px 0px 0px #000;
}

/* Add Link Section */
.add-link-section {
    padding-bottom: 32px;
    border-bottom: 2px solid #000;
    margin-bottom: 32px;
}

.add-link-form {
    margin-bottom: 16px;
}

.form-group {
    display: flex;
    gap: 0;
    align-items: stretch;
}

.url-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #000;
    border-right: none;
    font-size: 16px;
    background: #fff;
    color: #000;
    font-weight: 700;
    font-family: 'Berkeley Mono', monospace;
}

.url-input:focus {
    outline: none;
    background: #fafafa;
}

.url-input::placeholder {
    color: #666;
    font-weight: 700;
}

/* Neobrutalism Button System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    border: 2px solid #000;
    font-size: 14px;
    font-weight: 900;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    background: #fff;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: 'Berkeley Mono', monospace;
    box-shadow: 2px 2px 0px 0px #000;
    transition: all 0.1s ease;
    position: relative;
}

.btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px 0px #000;
}

.btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f5f5f5;
    color: #666;
    transform: none;
    box-shadow: 2px 2px 0px 0px #000;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: 2px 2px 0px 0px #000;
}

/* Primary button variant */
.btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}

.btn-primary:hover {
    background: #000;
    color: #fff;
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px 0px #000;
}

.btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

.btn-primary.htmx-request {
    opacity: 0.7;
    pointer-events: none;
}

/* Danger button variant */
.btn-danger {
    color: #dc2626;
    border-color: #dc2626;
    background: #fff;
    box-shadow: 2px 2px 0px 0px #dc2626;
}

.btn-danger:hover {
    background: #dc2626;
    color: #fff;
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px 0px #dc2626;
}

.btn-danger:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #dc2626;
}

/* Small button variant */
.btn-sm {
    padding: 12px 20px;
    font-size: 12px;
}

/* Extra small button variant */
.btn-xs {
    padding: 10px 16px;
    font-size: 12px;
    border-width: 2px;
    box-shadow: 2px 2px 0px 0px #000;
}

.btn-xs:hover {
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0px 0px #000;
}

.btn-xs:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0px 0px #000;
}

/* Active state for filter buttons */
.btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

/* Override for new tab-style filter buttons */
.filter-btn.active {
    color: #fff;
    background: #000;
    border-color: #000;
    font-weight: 900;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

.pagination-btn {
    min-width: 48px;
}

.pagination-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

.mark-read-btn {
    color: #000;
    border-color: #000;
    box-shadow: 2px 2px 0px 0px #000;
}

.mark-read-btn:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}

.read-badge {
    padding: 10px 16px;
    background: #f5f5f5;
    border: 2px solid #000;
    font-size: 12px;
    font-weight: 900;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 2px 2px 0px 0px #000;
}

/* Loading indicator */
.htmx-indicator {
    display: none;
    color: #000;
    font-weight: 700;
    padding: 12px 0;
    font-size: 14px;
    text-transform: uppercase;
}

.htmx-indicator.htmx-request {
    display: block;
}

/* Enhanced loading states for better UX */
#links-list.htmx-request {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

#links-list.htmx-request::before {
    content: "UPDATING...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 16px 24px;
    font-size: 14px;
    font-weight: 900;
    color: #000;
    border: 2px solid #000;
    z-index: 10;
    box-shadow: 3px 3px 0px 0px #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Links Section */
.filter-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
}

.filter-btn {
    padding: 16px 24px;
    background: #fff;
    border: 2px solid #000;
    font-size: 12px;
    font-weight: 900;
    color: #000;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 2px 2px 0px 0px #000;
    font-family: 'Berkeley Mono', monospace;
}

.filter-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px 0px #000;
}

.surprise-btn {
    margin-left: 16px;
    background: #000;
    color: #fff;
    border-color: #000;
    position: relative;
    overflow: hidden;
}

.surprise-btn:hover {
    background: #000;
    color: #fff;
    transform: translate(-2px, -2px);
    box-shadow: 3px 3px 0px 0px #000;
}

.surprise-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0px 0px #000;
}

/* Links List */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-item {
    background: #fff;
    border: 2px solid #000;
    padding: 0;
    transition: all 0.1s ease;
    position: relative;
    display: flex;
    box-shadow: 3px 3px 0px 0px #000;
}

.link-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0px 0px #000;
}

.link-item.read {
    opacity: 0.6;
    background: #f5f5f5;
}

/* Status indicator (left side) */
.link-item::before {
    content: "NEW";
    display: flex;
    width: 80px;
    background: #fff;
    border-right: 2px solid #000;
    font-size: 12px;
    font-weight: 900;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    text-align: center;
    padding: 24px 0;
    align-items: center;
    justify-content: center;
}

.link-item.read::before {
    display: flex;
    background: #000;
    color: #fff;
    content: "DONE";
}

.link-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex: 1;
    padding: 24px;
}

.link-info {
    flex: 1;
    min-width: 0;
}

.link-title {
    font-size: 16px;
    font-weight: 900;
    color: #000;
    margin-bottom: 12px;
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-transform: uppercase;
}

.link-url {
    color: #666;
    text-decoration: none;
    font-size: 13px;
    word-break: break-all;
    line-height: 1.4;
    display: block;
    margin-bottom: 12px;
    font-weight: 700;
    border: 1px solid #000;
    padding: 8px 12px;
    background: #fafafa;
    font-family: 'Berkeley Mono', monospace;
}

.link-url:hover {
    color: #000;
    background: #fff;
    transform: translate(-1px, -1px);
    box-shadow: 2px 2px 0px 0px #000;
}

.link-description {
    color: #000;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 700;
    background: #fafafa;
    border: 1px solid #000;
    padding: 12px;
    margin-top: 8px;
}

.link-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: flex-start;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #000;
    border: 2px solid #000;
    background: #fff;
    box-shadow: 4px 4px 0px 0px #000;
}

.empty-state h3 {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 16px;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-state p {
    font-size: 14px;
    color: #666;
    font-weight: 700;
}

/* Pagination */
.pagination {
    margin-top: 40px;
}

.pagination-info {
    text-align: center;
    color: #000;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 16px;
    }

    header h1 {
        font-size: 2rem;
        padding: 16px;
        box-shadow: 3px 3px 0px 0px #000;
    }

    main {
        padding: 24px 20px;
        box-shadow: 4px 4px 0px 0px #000;
    }

    .form-group {
        flex-direction: column;
        gap: 0;
    }

    .url-input {
        border-right: 2px solid #000;
        border-bottom: none;
    }

    .filter-controls {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 24px;
    }

    .filter-btn {
        padding: 14px 20px;
        font-size: 12px;
    }

    .surprise-btn {
        margin-left: 0;
    }

    .link-header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    .link-actions {
        align-self: flex-start;
    }

    .pagination-controls {
        gap: 6px;
    }

    .pagination-info {
        font-size: 12px;
    }
    
    .link-item::before {
        width: 60px;
        font-size: 10px;
        padding: 20px 0;
    }
}

/* Animations */
@keyframes brutalistPop {
    0% {
        transform: scale(0.95) translate(2px, 2px);
        box-shadow: 1px 1px 0px 0px #000;
    }
    50% {
        transform: scale(1.02) translate(-3px, -3px);
        box-shadow: 5px 5px 0px 0px #000;
    }
    100% {
        transform: scale(1) translate(0px, 0px);
        box-shadow: 3px 3px 0px 0px #000;
    }
}

@keyframes brutalistSlideIn {
    from {
        transform: translateX(-20px) translate(4px, 4px);
        box-shadow: 1px 1px 0px 0px #000;
        opacity: 0;
    }
    to {
        transform: translateX(0) translate(0px, 0px);
        box-shadow: 3px 3px 0px 0px #000;
        opacity: 1;
    }
}

.htmx-settling .link-item {
    animation: brutalistSlideIn 0.3s ease-out;
}

.htmx-swapping .link-item {
    animation: brutalistPop 0.2s ease-in;
}

/* Smoother transitions for the entire links list */
#links-list {
    transition: opacity 0.15s ease;
}

#links-list.htmx-swapping {
    opacity: 0.8;
}

/* Logout form */
.logout-form {
    position: absolute;
    top: 20px;
    right: 20px;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: 2px solid #000;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    box-shadow: 2px 2px 0px 0px #000;
    transition: all 0.1s ease;
}

.logout-btn:hover {
    background: #c82333;
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0px 0px #000;
}
