/* =============================================
   URL Shortener - Final CSS
   Theme: Makui Luangdi Festival 2025
   Clean, Responsive, Modern Design
   Supports: Frontend, Admin, Mobile
   ============================================= */

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

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
    padding: 0;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 820px;
    margin: 30px auto;
    padding: 20px;
    min-height: calc(100vh - 100px);
}

/* Typography */
h1, h2, h3 {
    color: #2c3e50;
    margin-bottom: 16px;
    font-weight: 600;
}

p {
    color: #555;
    margin-bottom: 16px;
    font-size: 16px;
}

a {
    color: #3498db;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Card Layout */
.card {
    background: white;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    border: 1px solid #e0e6ed;
}

/* Form Elements */
input[type="url"],
input[type="text"],
input[type="datetime-local"] {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: 1px solid #ddd;
    border-radius: 9px;
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #ffffff;
}

input[type="url"]:focus,
input[type="text"]:focus,
input[type="datetime-local"]:focus {
    border-color: #e65100; /* Festival orange */
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.18);
    transform: translateY(-1px);
}

/* Buttons */
button {
    background: #e65100; /* Makui Luangdi Orange */
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}

button:hover {
    background: #d84315; /* Darker orange */
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(230, 81, 0, 0.2);
}

button:active {
    transform: translateY(0);
}

/* Secondary Buttons */
.btn-cancel {
    background: #95a5a6;
}

.copy-btn {
    background: #673ab7; /* Deep purple */
}

.copy-btn:hover,
.btn-cancel:hover {
    background: #546e7a;
}

/* Form */
form {
    margin: 25px 0;
}

form button {
    width: 100%;
    margin-top: 12px;
    font-weight: 600;
}

/* Result Box */
.result-box {
    margin-top: 25px;
    padding: 22px;
    background: #fff3e0; /* Warm light orange */
    border-radius: 11px;
    border-left: 6px solid #ff9800;
    word-wrap: break-word;
}

.url-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
    background: #fff;
    padding: 14px;
    border-radius: 7px;
    border: 1px solid #ffe0b2;
}

#short-url {
    flex: 1;
    padding: 11px;
    background: #fff8e1;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    color: #d84315;
    border: 1px solid #ffcc80;
}

.copy-btn {
    white-space: nowrap;
    font-size: 14px;
}

/* Error & Success Messages */
.error {
    margin: 16px 0;
    padding: 15px;
    background: #ffebee;
    color: #c62828;
    border-radius: 9px;
    border-left: 6px solid #f44336;
    font-size: 15px;
}

.alert {
    padding: 15px;
    border-radius: 9px;
    margin: 16px 0;
    font-weight: 500;
}

.alert-success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 6px solid #4caf50;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border-left: 6px solid #f44336;
}

/* Donate Section */
.donate-section {
    margin-top: 30px;
    padding: 24px;
    background: #fff3e0;
    border-radius: 13px;
    border: 1px dashed #ff9800;
    text-align: center;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(230, 81, 0, 0.1);
}

.donate-section h3 {
    color: #e65100;
    margin-bottom: 12px;
    font-size: 19px;
    font-weight: 600;
}

.donate-section img {
    max-width: 170px;
    margin: 12px auto;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    border: 2px solid #ffcc80;
}

.donate-upi {
    margin: 14px 0;
    font-family: 'Courier New', monospace;
    background: #ffecb3;
    padding: 9px 14px;
    border-radius: 7px;
    display: inline-block;
    font-size: 16px;
    color: #bf360c;
    font-weight: bold;
    border: 1px solid #ffb74d;
}

/* Table Styling (Admin Panel) */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 22px 0;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 15px 13px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #fff3e0;
    color: #d84315;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
}

tbody tr:hover {
    background: #fff8e1;
    transition: background 0.25s ease;
}

.url-preview {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.ref-link {
    color: #1a0dab;
    text-decoration: underline;
}

.user-agent {
    font-size: 13px;
    color: #555;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pagination */
.pagination {
    margin: 28px 0;
    text-align: center;
}

.pagination a {
    display: inline-block;
    padding: 11px 15px;
    margin: 0 5px;
    border: 1px solid #ddd;
    border-radius: 7px;
    text-decoration: none;
    color: #e65100;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: #e65100;
    color: white;
    border-color: #e65100;
}

.pagination a.active {
    background: #e65100;
    color: white;
    border-color: #e65100;
    font-weight: bold;
}

/* Stat Cards */
.stat-card {
    background: #fff8e1;
    padding: 20px;
    border-radius: 11px;
    margin: 16px 0;
    border-left: 6px solid #ff9800;
    font-size: 15px;
    border: 1px solid #ffecb3;
}

.stat-card ul {
    margin: 12px 0;
    list-style: none;
}

.stat-card li {
    margin: 7px 0;
    color: #37474f;
}

/* Search & Filter Box */
.search-box {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 22px;
    align-items: center;
}

.search-box input,
.search-box select,
.search-box button {
    padding: 13px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
}

.search-box button {
    background: #e65100;
    color: white;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.search-box button:hover {
    background: #d84315;
}

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

    .card {
        padding: 22px;
    }

    h1 {
        font-size: 24px;
    }

    .url-display {
        flex-direction: column;
        align-items: stretch;
    }

    #short-url {
        font-size: 13px;
    }

    .copy-btn {
        width: 100%;
        margin-top: 12px;
    }

    table, .search-box {
        font-size: 14px;
    }

    th, td {
        padding: 11px 9px;
    }
}

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

    .container {
        margin: 12px;
    }

    .donate-section img {
        max-width: 150px;
    }

    .pagination a {
        padding: 8px 10px;
        font-size: 13px;
    }
}

/* Print-Friendly */
@media print {
    body * {
        visibility: hidden;
    }
    .result-box, .result-box * {
        visibility: visible;
    }
    .result-box {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .card, .donate-section, form, table {
        display: none;
    }
}

/* =============================================
   NIGHT MODE / DARK THEME
   ============================================= */

body.dark-mode {
    background: #121212 !important;
    color: #e0e0e0 !important;
}

.dark-mode .card {
    background: #1e1e1e !important;
    border-color: #333 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
}

.dark-mode h1, 
.dark-mode h2, 
.dark-mode h3, 
.dark-mode p {
    color: #f0f0f0;
}

.dark-mode a {
    color: #bb86fc;
}

.dark-mode input[type="url"],
.dark-mode input[type="text"],
.dark-mode input[type="datetime-local"] {
    background: #2c2c2c !important;
    color: #fff !important;
    border-color: #555 !important;
}

.dark-mode input[type="url"]:focus,
.dark-mode input[type="text"]:focus,
.dark-mode input[type="datetime-local"]:focus {
    border-color: #bb86fc !important;
    box-shadow: 0 0 0 3px rgba(187, 134, 252, 0.25) !important;
}

.dark-mode .result-box {
    background: #2d2d2d !important;
    border-left-color: #bb86fc !important;
}

.dark-mode .url-display {
    background: #2c2c2c !important;
    border-color: #444 !important;
}

.dark-mode #short-url {
    background: #333 !important;
    color: #bb86fc !important;
    border-color: #555 !important;
}

.dark-mode .copy-btn {
    background: #9b59b6 !important;
}

.dark-mode .error {
    background: #381d2a !important;
    border-left-color: #cf3659 !important;
    color: #ff80ab !important;
}

.dark-mode .donate-section {
    background: #2a2a2a !important;
    border-color: #666 !important;
    color: #e0e0e0 !important;
}