/* ==================== Global Styles ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #DCF8C6;
    --secondary-color: #075E54;
    --accent-color: #34B7F1;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #667781;
    --border-color: #e9edef;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --gradient: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== Header ==================== */
.header {
    background: var(--gradient);
    color: white;
    padding: 40px 0;
    text-align: center;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 15s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
}

.logo i {
    font-size: 48px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo h1 {
    font-size: 2.5em;
    font-weight: 700;
}

.tagline {
    font-size: 1.1em;
    opacity: 0.95;
    position: relative;
    z-index: 1;
}

/* ==================== Main Content ==================== */
.main-content {
    flex: 1;
    padding: 60px 0;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

/* ==================== Service Cards ==================== */
.service-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-light);
}

.card-header i {
    font-size: 32px;
    color: var(--primary-color);
    animation: fadeIn 0.5s ease;
}

.card-header h2 {
    font-size: 1.5em;
    color: var(--text-primary);
}

.card-description {
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-size: 0.95em;
}

/* ==================== Form Elements ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95em;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667781' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    padding-left: 40px;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: center;
    font-family: inherit;
}

.btn-primary {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
    flex: 1;
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
}

.format-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

/* ==================== Result Box ==================== */
.result-box {
    margin-top: 20px;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.4s ease;
    opacity: 0;
}

.result-box.show {
    max-height: 500px;
    opacity: 1;
    padding: 20px;
    background: linear-gradient(135deg, #f6f9fc 0%, #e9f5f0 100%);
    border-radius: 8px;
    border-right: 4px solid var(--primary-color);
}

.result-link {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.result-link input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
}

.result-link button {
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    white-space: nowrap;
}

.result-link button:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.result-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.result-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-copy {
    background: var(--primary-color);
    color: white;
}

.btn-copy:hover {
    background: var(--primary-dark);
}

.btn-open {
    background: var(--accent-color);
    color: white;
}

.btn-open:hover {
    background: #0d8ecf;
}

.btn-download {
    background: var(--secondary-color);
    color: white;
}

.btn-download:hover {
    background: #054740;
}

/* QR Code Result */
.qr-result {
    text-align: center;
}

.qr-result img {
    max-width: 250px;
    margin: 20px auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* Formatted Text Result */
.formatted-text {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 2px dashed var(--border-color);
    font-family: monospace;
    font-size: 0.95em;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Group Info */
.group-info {
    background: white;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.group-info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.group-info-item:last-child {
    border-bottom: none;
}

.group-info-item strong {
    color: var(--text-primary);
}

.group-info-item span {
    color: var(--text-secondary);
}

/* ==================== Toast Notification ==================== */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    z-index: 1000;
    transition: bottom 0.4s ease;
}

.toast.show {
    bottom: 30px;
}

.toast i {
    font-size: 20px;
}

/* ==================== Footer ==================== */
.footer {
    background: var(--secondary-color);
    color: white;
    padding: 30px 0;
    text-align: center;
    margin-top: auto;
}

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.social-links a:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.service-card {
    animation: fadeIn 0.6s ease;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .logo h1 {
        font-size: 1.8em;
    }

    .tagline {
        font-size: 0.95em;
    }

    .service-card {
        padding: 20px;
    }

    .card-header h2 {
        font-size: 1.3em;
    }

    .result-link {
        flex-direction: column;
    }

    .result-link button {
        width: 100%;
    }

    .format-buttons {
        flex-direction: column;
    }

    .footer .container {
        padding: 0 15px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 30px 0;
    }

    .logo {
        flex-direction: column;
        gap: 10px;
    }

    .logo h1 {
        font-size: 1.5em;
    }

    .logo i {
        font-size: 36px;
    }

    .main-content {
        padding: 30px 0;
    }

    .service-card {
        padding: 15px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.95em;
    }

    .result-actions {
        flex-direction: column;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .header, .footer, .btn {
        display: none;
    }

    .service-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ==================== Dark Mode Support ==================== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0b141a;
        --card-bg: #1f2c34;
        --text-primary: #e9edef;
        --text-secondary: #8696a0;
        --border-color: #2a3942;
    }

    .form-control {
        background: #2a3942;
        color: var(--text-primary);
    }

    .formatted-text,
    .group-info {
        background: #2a3942;
    }
}

/* ==================== Accessibility ==================== */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .service-card {
        border: 2px solid var(--text-primary);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

