* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #49bc85;
    --primary-green-dark: #3da372;
    --bg-white: #FFFFFF;
    --bg-light: #F5F5F5;
    --bg-grey: #F0F0F0;
    --text-dark: #333333;
    --text-gray: #666666;
    --text-light: #999999;
    --border: #E0E0E0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background: var(--bg-grey);
    line-height: 1.6;
}

/* Header */
.header__wrap {
    background: var(--primary-green);
    border-bottom: 1px solid var(--border);
}

.header__main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header__logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    letter-spacing: -0.3px;
}

.showheader__nickname {
    font-size: 2rem;
    font-weight: 500;
    color: white;
    margin: 0;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 300px);
    padding: 2rem 0;
    background: var(--bg-grey);
}

/* Create Section */
.create-section {
    max-width: 1200px;
    margin: 0 auto 2rem;
    padding: 2rem;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.create-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    font-weight: 500;
}

.create-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

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

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-white);
    width: 100%;
    color: var(--text-dark);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-green);
}

.input-wrapper {
    position: relative;
}

.currency {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-gray);
    font-weight: 600;
}

.input-wrapper input {
    padding-left: 2rem;
    color: var(--text-dark);
}

/* Buttons */
.btn-primary {
    padding: 0.75rem 2rem;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-primary:hover {
    background: var(--primary-green-dark);
}

.btn-secondary {
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--border);
}

/* Links Section */
.links-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    font-weight: 500;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.link-card {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-white);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.link-card:hover {
    border-color: var(--primary-green);
    box-shadow: 0 2px 12px rgba(73, 188, 133, 0.15);
    transform: translateY(-2px);
}

.link-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.link-amount-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.link-amount-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

.link-status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.link-status-badge.status-pending {
    background: rgba(73, 188, 133, 0.1);
    color: var(--primary-green);
}

.link-status-badge.status-completed {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.link-status-badge.status-cancelled {
    background: rgba(244, 67, 54, 0.1);
    color: #F44336;
}

.link-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--primary-green);
    color: white;
    border-color: var(--primary-green);
}

.btn-icon.btn-delete:hover {
    background: #F44336;
    border-color: #F44336;
}

.link-invoice-number {
    font-size: 0.9rem;
    color: var(--primary-green);
    font-weight: 600;
    margin-top: 0.5rem;
}

.link-seller {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-top: 0.5rem;
    font-weight: 500;
}

.link-description {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
    margin-top: 0.5rem;
}

.link-customer {
    font-size: 0.9rem;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.link-url-section {
    margin-top: 0.5rem;
}

.link-url {
    padding: 0.75rem;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--primary-green);
    word-break: break-all;
    display: block;
    text-decoration: none;
    transition: all 0.2s ease;
}

.link-url:hover {
    background: rgba(73, 188, 133, 0.1);
    border-color: var(--primary-green);
    text-decoration: underline;
}

.link-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.link-id {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-light);
}

.link-date {
    font-size: 0.75rem;
    color: var(--text-light);
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-gray);
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-gray);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-detail {
    margin-bottom: 1rem;
}

.modal-detail label {
    font-weight: 600;
    color: var(--text-gray);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.25rem;
}

.modal-detail .value {
    color: var(--text-dark);
    word-break: break-all;
}

.modal-url {
    display: block;
    text-decoration: none;
    color: var(--primary-green);
    background: var(--bg-light);
    padding: 0.75rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
    border: 1px solid var(--border);
}

.modal-url:hover {
    background: rgba(73, 188, 133, 0.1);
    border-color: var(--primary-green);
    text-decoration: underline;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    background: var(--text-dark);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: none;
    animation: slideIn 0.3s ease;
}

.toast.show {
    display: block;
}

.toast.success {
    background: var(--primary-green);
}

.toast.error {
    background: #F44336;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer */
.userfooter__main {
    background: var(--primary-green);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
}

.userfooter__content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.userfooter__copyright {
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    opacity: 0.95;
}

.userfooter__copyright:last-child {
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .header__main {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .link-info {
        grid-template-columns: 1fr;
    }
    
    .link-card {
        padding: 1rem;
    }
    
    .modal-content {
        max-width: 95%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.25rem;
    }
    
    .header__main {
        padding: 0.75rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .form-field input,
    .form-field select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
    }
    
    .btn-primary,
    .btn-secondary {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .link-card {
        padding: 0.75rem;
    }
    
    .link-amount-value {
        font-size: 1.5rem;
    }
    
    .modal-content {
        max-width: 100%;
        padding: 1rem;
        margin: 0.5rem;
    }
    
    .modal-header h2 {
        font-size: 1.25rem;
    }
}
