/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --danger: #ef4444;
    --danger-hover: #f87171;
    --border: #2d2d44;
    --shadow: rgba(0, 0, 0, 0.3);
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

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

body {
    font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Container ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ===== Header ===== */
.header {
    margin-bottom: 3rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-title {
    text-align: left;
}

.logo {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tagline {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
}

.btn-admin {
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.btn-admin:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.btn-admin.logged-in {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
}

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

/* ===== Modal ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 40px var(--shadow);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    border-bottom: none;
    padding-bottom: 0;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ===== Sections ===== */
section {
    margin-bottom: 2.5rem;
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* ===== Form ===== */
.form-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
}

.site-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.btn-primary {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===== Sites Grid ===== */
.sites-section {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
}

.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ===== Site Card ===== */
.site-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.site-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--shadow);
}

.site-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.site-card .url {
    display: block;
    color: var(--accent-hover);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    word-break: break-all;
    transition: color 0.2s;
}

.site-card .url:hover {
    color: var(--gradient-start);
    text-decoration: underline;
}

.site-card .description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.site-card .btn-delete {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.site-card .btn-delete:hover {
    color: var(--danger);
}

/* ===== Empty State ===== */
.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
    font-size: 1.1rem;
}

.empty-message.hidden {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .logo {
        font-size: 2rem;
    }

    .form-section,
    .sites-section {
        padding: 1.5rem;
    }

    .sites-grid {
        grid-template-columns: 1fr;
    }
}