/**
 * HugBook Gjestebok - MSN Messenger Norge Style
 * Inspired by Windows XP and MSN Messenger circa 2003-2005
 */

/* =============================================================================
   CSS RESET & BASE
   ============================================================================= */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: Tahoma, "Segoe UI", Geneva, Verdana, sans-serif;
    font-size: 11px;
    line-height: 1.4;
    color: #000000;
    background-color: #ECE9D8; /* Windows XP beige */
    min-height: 100vh;
}

/* =============================================================================
   LAYOUT
   ============================================================================= */

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

main {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* =============================================================================
   MSN HEADER
   ============================================================================= */

.msn-header {
    background: linear-gradient(180deg, #1E5799 0%, #207CE5 50%, #1E5799 100%);
    border: 1px solid #0B3D91;
    border-radius: 6px 6px 0 0;
    padding: 12px 15px;
    margin-bottom: 0;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-content {
    text-align: center;
}

.msn-header h1 {
    margin: 0;
    font-family: "Trebuchet MS", Tahoma, sans-serif;
    font-size: 20px;
    font-weight: bold;
    color: #FFFFFF;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.msn-header .tagline {
    margin: 4px 0 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.9);
}

/* =============================================================================
   SECTION STYLING (MSN Window Look)
   ============================================================================= */

.intro-section,
.form-section,
.entries-section {
    background: #FFFFFF;
    border: 1px solid #ACA899;
    border-top: none;
    padding: 15px;
}

.intro-section {
    border-radius: 0;
    background: linear-gradient(180deg, #FFFEF5 0%, #FFFFFF 100%);
}

.form-section {
    border-radius: 0;
}

.entries-section {
    border-radius: 0 0 6px 6px;
}

/* =============================================================================
   INTRO SECTION (HugByte Vibes)
   ============================================================================= */

.intro-quote {
    background: #F8F6ED;
    border-left: 3px solid #1E5799;
    padding: 12px 15px;
    margin-bottom: 15px;
    font-style: italic;
}

.quote-text {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: #333333;
    line-height: 1.5;
}

.quote-attr {
    margin: 0;
    font-size: 10px;
    color: #666666;
    text-align: right;
}

.intro-content {
    font-size: 11px;
    line-height: 1.6;
    color: #333333;
}

.intro-content p {
    margin: 0 0 10px 0;
}

.intro-welcome {
    font-size: 13px;
    color: #003399;
}

.intro-welcome strong {
    color: #1E5799;
}

.intro-vibe {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
    padding: 10px;
    background: #F5F5F5;
    border: 1px dashed #CCCCCC;
}

.vibe-item {
    font-size: 10px;
    padding: 3px 8px;
    background: #FFFFFF;
    border: 1px solid #D4D0C8;
    border-radius: 2px;
    color: #666666;
    white-space: nowrap;
}

.intro-cta {
    font-size: 11px;
    color: #333333;
    padding: 10px;
    background: linear-gradient(180deg, #E8F4FF 0%, #D0E8FF 100%);
    border: 1px solid #99CCFF;
    border-radius: 3px;
    text-align: center;
    margin-bottom: 0 !important;
}

.intro-cta small {
    color: #666666;
    font-size: 9px;
}

.section-title {
    margin: 0 0 12px 0;
    padding: 0 0 8px 0;
    font-size: 12px;
    font-weight: bold;
    color: #003399;
    border-bottom: 1px solid #D4D0C8;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.entry-count {
    font-size: 10px;
    font-weight: normal;
    color: #666666;
}

/* =============================================================================
   FORM STYLING
   ============================================================================= */

.msn-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

.form-group label {
    font-size: 11px;
    font-weight: bold;
    color: #000000;
}

.required {
    color: #CC0000;
}

.optional {
    font-weight: normal;
    color: #666666;
}

.form-group input[type="text"],
.form-group input[type="url"],
.form-group textarea {
    font-family: Tahoma, sans-serif;
    font-size: 11px;
    padding: 4px 6px;
    border: 1px solid #7F9DB9;
    border-radius: 0;
    background: #FFFFFF;
    color: #000000;
    width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #0066CC;
    box-shadow: 0 0 0 1px #0066CC;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.char-count {
    position: absolute;
    right: 0;
    bottom: -14px;
    font-size: 9px;
    color: #999999;
}

/* Honeypot field - hidden from humans */
.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* =============================================================================
   AVATAR PICKER
   ============================================================================= */

.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
    background: #F5F5F5;
    border: 1px solid #D4D0C8;
}

.avatar-option {
    cursor: pointer;
    display: block;
}

.avatar-option input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.avatar-option img {
    display: block;
    border: 2px solid transparent;
    border-radius: 2px;
    transition: border-color 0.1s;
}

.avatar-option input:checked + img {
    border-color: #0066CC;
    box-shadow: 0 0 0 1px #0066CC;
}

.avatar-option:hover img {
    border-color: #99CCFF;
}

.avatar-option input:focus + img {
    outline: 2px dashed #0066CC;
    outline-offset: 2px;
}

/* =============================================================================
   MSN-STYLE BUTTONS
   ============================================================================= */

.msn-button {
    font-family: Tahoma, sans-serif;
    font-size: 11px;
    padding: 4px 16px;
    cursor: pointer;
    border: 1px solid;
    border-color: #FFFFFF #706F64 #706F64 #FFFFFF;
    border-radius: 3px;
    background: linear-gradient(180deg, #F5F5F5 0%, #DCDCDC 50%, #C8C8C8 100%);
    color: #000000;
    box-shadow:
        inset 0 1px 0 #FFFFFF,
        1px 1px 2px rgba(0, 0, 0, 0.1);
    transition: none;
}

.msn-button:hover {
    background: linear-gradient(180deg, #FFFFFF 0%, #E8E8E8 50%, #D8D8D8 100%);
}

.msn-button:active {
    border-color: #706F64 #FFFFFF #FFFFFF #706F64;
    background: linear-gradient(180deg, #C8C8C8 0%, #DCDCDC 50%, #F5F5F5 100%);
    box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.msn-button:focus {
    outline: 1px dotted #000000;
    outline-offset: -4px;
}

.msn-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.msn-button.small {
    padding: 2px 10px;
    font-size: 10px;
}

.form-actions {
    padding-top: 8px;
}

.btn-loading {
    display: none;
}

.msn-button[disabled] .btn-text {
    display: none;
}

.msn-button[disabled] .btn-loading {
    display: inline;
}

/* =============================================================================
   FEEDBACK MESSAGES
   ============================================================================= */

.feedback {
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 11px;
    margin-top: 8px;
}

.feedback.success {
    background: #DFF0D8;
    border: 1px solid #6BB700;
    color: #3C763D;
}

.feedback.error {
    background: #F2DEDE;
    border: 1px solid #CC0000;
    color: #A94442;
}

/* =============================================================================
   ENTRIES LIST
   ============================================================================= */

.entries-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.loading-message,
.no-js-message {
    text-align: center;
    color: #666666;
    padding: 20px;
    font-style: italic;
}

.entry {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #FAFAFA;
    border: 1px solid #D4D0C8;
    border-radius: 2px;
}

.entry-avatar {
    flex-shrink: 0;
}

.entry-avatar img {
    display: block;
    border: 1px solid #ACA899;
    border-radius: 2px;
}

.entry-content {
    flex: 1;
    min-width: 0;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.entry-name {
    font-weight: bold;
    color: #003399;
    font-size: 11px;
}

.entry-name a {
    color: #0066CC;
    text-decoration: none;
}

.entry-name a:hover {
    text-decoration: underline;
}

.entry-date {
    font-size: 9px;
    color: #999999;
    white-space: nowrap;
}

.entry-message {
    font-size: 11px;
    color: #000000;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 30px;
    color: #666666;
}

.empty-state p {
    margin: 0;
}

/* =============================================================================
   PAGINATION
   ============================================================================= */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding-top: 15px;
    border-top: 1px solid #D4D0C8;
    margin-top: 15px;
}

.page-info {
    font-size: 10px;
    color: #666666;
}

/* =============================================================================
   FOOTER
   ============================================================================= */

.msn-footer {
    margin-top: 15px;
    padding: 10px;
    text-align: center;
    font-size: 10px;
    color: #666666;
}

.msn-footer a {
    color: #0066CC;
    text-decoration: none;
}

.msn-footer a:hover {
    text-decoration: underline;
}

.retro-text {
    margin-top: 6px;
    font-style: italic;
    color: #999999;
}

/* =============================================================================
   WINDOWS XP SCROLLBAR (Webkit browsers)
   ============================================================================= */

::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: #ECE9D8;
    border: 1px solid #ACA899;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #E8E8E8 0%, #C8C8C8 50%, #B8B8B8 100%);
    border: 1px solid;
    border-color: #FFFFFF #706F64 #706F64 #FFFFFF;
    border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #F0F0F0 0%, #D8D8D8 50%, #C8C8C8 100%);
}

::-webkit-scrollbar-button {
    display: none;
}

/* =============================================================================
   ADMIN PAGE STYLES
   ============================================================================= */

.admin-container {
    max-width: 900px;
}

.login-form {
    max-width: 300px;
    margin: 50px auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
}

.admin-table th,
.admin-table td {
    padding: 6px 8px;
    text-align: left;
    border-bottom: 1px solid #D4D0C8;
}

.admin-table th {
    background: #F5F5F5;
    font-weight: bold;
    color: #003399;
}

.admin-table tr:hover {
    background: #FFFFD8;
}

.admin-table .hidden-entry {
    opacity: 0.5;
    background: #FFF0F0;
}

.admin-actions {
    display: flex;
    gap: 4px;
}

.admin-actions button {
    padding: 2px 6px;
    font-size: 9px;
}

.admin-actions .danger {
    background: linear-gradient(180deg, #FFC8C8 0%, #FF9999 100%);
    border-color: #CC0000;
}

.admin-actions .danger:hover {
    background: linear-gradient(180deg, #FFD8D8 0%, #FFAAAA 100%);
}

.message-preview {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 480px) {
    body {
        font-size: 12px;
    }

    .container {
        padding: 5px;
    }

    .msn-header {
        padding: 10px;
    }

    .msn-header h1 {
        font-size: 18px;
    }

    .form-section,
    .entries-section {
        padding: 10px;
    }

    .avatar-picker {
        gap: 4px;
        padding: 6px;
    }

    .avatar-option img {
        width: 40px;
        height: 40px;
    }

    .entry {
        padding: 8px;
        gap: 8px;
    }

    .entry-avatar img {
        width: 36px;
        height: 36px;
    }

    .pagination {
        gap: 10px;
    }

    .admin-table {
        font-size: 9px;
    }

    .admin-table th,
    .admin-table td {
        padding: 4px;
    }

    .message-preview {
        max-width: 100px;
    }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    body {
        background: #FFFFFF;
    }

    .form-section,
    .pagination,
    .msn-footer {
        display: none;
    }

    .msn-header {
        background: none;
        border: none;
        color: #000000;
    }

    .msn-header h1 {
        color: #000000;
        text-shadow: none;
    }

    .entry {
        break-inside: avoid;
    }
}

/* =============================================================================
   FOCUS STYLES (Accessibility)
   ============================================================================= */

:focus-visible {
    outline: 2px solid #0066CC;
    outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0066CC;
    color: #FFFFFF;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* =============================================================================
   ANIMATIONS (Subtle)
   ============================================================================= */

@keyframes nudge {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

.entry.new {
    animation: nudge 0.3s ease-in-out;
    background: #FFFFD8;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.entry {
    animation: fadeIn 0.2s ease-out;
}
