/* ========================================
   PGR 놀이터 - Modern Design System
   ======================================== */

/* CSS Variables - Design Tokens */
:root {
    /* Primary Colors - Elegant Purple-Blue Gradient */
    --primary-50: #f5f3ff;
    --primary-100: #ede9fe;
    --primary-200: #ddd6fe;
    --primary-300: #c4b5fd;
    --primary-400: #a78bfa;
    --primary-500: #8b5cf6;
    --primary-600: #7c3aed;
    --primary-700: #6d28d9;
    --primary-800: #5b21b6;
    --primary-900: #4c1d95;

    /* Neutral Colors */
    --gray-50: #fafafa;
    --gray-100: #f4f4f5;
    --gray-200: #e4e4e7;
    --gray-300: #d4d4d8;
    --gray-400: #a1a1aa;
    --gray-500: #71717a;
    --gray-600: #52525b;
    --gray-700: #3f3f46;
    --gray-800: #27272a;
    --gray-900: #18181b;

    /* Accent Colors */
    --success-500: #22c55e;
    --success-50: #f0fdf4;
    --error-500: #ef4444;
    --error-50: #fef2f2;
    --warning-500: #f59e0b;
    --like-color: #ec4899;
    --like-bg: #fdf2f8;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Border Radius */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --container-max: 1200px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--gray-800);
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    margin-bottom: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow var(--transition);
}

header:hover {
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: inline-block;
}

header h1 a {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: opacity var(--transition);
}

header h1 a:hover {
    opacity: 0.8;
}

/* Navigation */
nav {
    float: right;
    line-height: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    nav {
        float: none;
    }
}

nav a, nav span {
    margin-left: 0.75rem;
    color: var(--gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}

nav a:hover {
    color: var(--primary-600);
    background: var(--primary-50);
}

/* Main Content */
main {
    min-height: calc(100vh - 200px);
    padding-bottom: 2rem;
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-900) 100%);
    color: var(--gray-300);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
    font-size: 0.875rem;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: var(--success-50);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--error-50);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary-600) 100%);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.45);
    transform: translateY(-1px);
}

.btn-like {
    background: white;
    color: var(--gray-700);
    border: 1.5px solid var(--gray-200);
    padding: 0.625rem 1rem;
}

.btn-like:hover {
    border-color: var(--like-color);
    background: var(--like-bg);
}

.btn-like.liked {
    background: var(--like-bg);
    border-color: var(--like-color);
    color: var(--like-color);
}

/* Welcome Section */
.welcome {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
    max-width: 500px;
    margin: 2rem auto;
}

.welcome h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome p {
    margin-bottom: 1rem;
    color: var(--gray-600);
    line-height: 1.7;
}

.welcome .btn {
    margin-top: 0.5rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

/* Board Section */
.board {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}

.board-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--gray-800);
}

/* Post List Table */
.post-list {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.post-list th {
    background: var(--gray-50);
    padding: 0.875rem 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
}

.post-list th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.post-list th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.post-list td {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
    transition: background var(--transition);
}

.post-list tbody tr {
    transition: all var(--transition);
}

.post-list tbody tr:hover {
    background: var(--primary-50);
}

.post-list tbody tr:last-child td {
    border-bottom: none;
}

.post-list .post-title a {
    color: var(--gray-800);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
}

.post-list .post-title a:hover {
    color: var(--primary-600);
}

.post-list .empty {
    text-align: center;
    color: var(--gray-400);
    padding: 3rem;
    font-size: 0.95rem;
}

/* Pagination */
.pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
    gap: 0.375rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1.5px solid var(--gray-200);
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.pagination a:hover {
    border-color: var(--primary-400);
    background: var(--primary-50);
    color: var(--primary-600);
}

.pagination .current {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

/* Post Detail */
.post-detail {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
}

.post-header {
    border-bottom: 1px solid var(--gray-100);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
}

.post-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-900);
    line-height: 1.4;
}

.post-meta {
    color: var(--gray-500);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    background: var(--gray-50);
    border-radius: var(--radius-full);
}

.post-content {
    margin-bottom: 2rem;
    line-height: 1.9;
    color: var(--gray-700);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 1rem;
}

.post-actions {
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-100);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.post-actions .btn {
    margin-right: 0;
}

/* Likers Section */
.likers {
    margin-top: 2rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, var(--like-bg) 0%, #fce7f3 100%);
    border-radius: var(--radius-lg);
    border: 1px solid #fbcfe8;
}

.likers h4 {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-700);
}

.liker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.liker {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: white;
    border: 1px solid #fbcfe8;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-700);
    box-shadow: var(--shadow-sm);
}

/* Post Form */
.post-form {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-100);
}

.post-form h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--gray-800);
}

.form-group {
    margin-bottom: 1.75rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition);
    background: var(--gray-50);
}

.form-group input:hover,
.form-group textarea:hover {
    border-color: var(--gray-300);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    background: white;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

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

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ========================================
   Responsive Styles
   ======================================== */

@media (max-width: 768px) {
    /* Header */
    header .container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }

    header h1 {
        font-size: 1.25rem;
    }

    /* Container */
    .container {
        padding: 0 16px;
    }

    /* Welcome */
    .welcome {
        padding: 2rem 1.5rem;
        margin: 1rem;
        border-radius: var(--radius-lg);
    }

    .welcome h2 {
        font-size: 1.5rem;
    }

    /* Board */
    .board {
        padding: 1.25rem;
        border-radius: var(--radius-lg);
        margin: 0;
    }

    .board-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding-bottom: 1rem;
    }

    .board-header h2 {
        font-size: 1.15rem;
        margin-bottom: 0;
    }

    /* Remove horizontal scroll */
    body {
        overflow-x: hidden;
    }

    .container {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Post Detail */
    .post-detail {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .post-header h2 {
        font-size: 1.25rem;
    }

    .post-meta {
        font-size: 0.8rem;
        gap: 0.375rem;
    }

    .post-meta span {
        padding: 0.2rem 0.5rem;
        font-size: 0.75rem;
    }

    .post-actions {
        flex-direction: column;
    }

    .post-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 0.75rem 1rem;
    }

    /* Form */
    .post-form {
        padding: 1.5rem;
        border-radius: var(--radius-lg);
    }

    .post-form h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .pagination a,
    .pagination span {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0 0.5rem;
        font-size: 0.8rem;
    }

    /* Footer */
    footer {
        padding: 1.25rem 0;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.1rem;
    }

    .post-list {
        font-size: 0.8rem;
    }

    .welcome {
        padding: 1.5rem 1rem;
    }

    .welcome h2 {
        font-size: 1.25rem;
    }

    /* Likers */
    .liker-list {
        justify-content: flex-start;
    }

    .liker {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Landscape mode */
@media (max-width: 768px) and (orientation: landscape) {
    header {
        padding: 0.5rem 0;
    }

    main {
        min-height: calc(100vh - 150px);
    }
}

/* ========================================
   Utility Classes
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn var(--transition-slow) ease-out;
}
