/* Devices Page Specific Styles */
.container .card:first-child {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: white;
    border: none;
    margin-bottom: 2rem;
}

.container .card:first-child h2 {
    color: white;
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
    font-weight: 700;
}

.container .card:first-child p {
    opacity: 0.9;
    font-size: 1.1rem;
    margin: 0;
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.device-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--accent);
}

.device-card.offline::before {
    background: linear-gradient(135deg, var(--danger) 0%, #c0392b 100%);
}

.device-card.online::before {
    background: linear-gradient(135deg, var(--success) 0%, #229954 100%);
}

/* Device Header */
.device-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.device-icon {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.device-info {
    flex: 1;
    min-width: 0;
}

.device-info h4 {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.device-location {
    color: var(--accent);
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.device-id, .last-seen {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.device-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
}

.device-status.online {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
}

.device-status.offline {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
}

/* Updated for three credential items */
.device-credentials {
    background: var(--bg-secondary);
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.credential-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

.credential-item:last-child {
    margin-bottom: 0;
}

.credential-item label {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
    font-size: 0.9rem;
}

.credential-value {
    flex: 1;
    font-family: 'Courier New', monospace;
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-primary);
    word-break: break-all;
}

.btn-copy {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

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

/* Responsive design for credential items */
@media (max-width: 768px) {
    .credential-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .credential-item label {
        min-width: auto;
    }
    
    .btn-copy {
        width: 100%;
    }
    .container .card:first-child h2 {
    font-size: 1.5rem;
}
}

/* Device Actions */
.device-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.device-actions .btn {
    flex: 1;
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
}

/* Add Device Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group input {
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

.form-group small {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 2px dashed var(--border);
}

.welcome-icon {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 3rem;
}

.welcome-message h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.welcome-message p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.welcome-features {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.feature i {
    color: var(--accent);
}

/* Form Messages */
.form-error, .form-success {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.form-error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.form-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

/* Responsive */
@media (max-width: 768px) {
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .device-header {
        flex-direction: column;
        text-align: center;
    }
    
    .device-icon {
        align-self: center;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .device-actions {
        flex-direction: column;
    }
    
    .credential-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .btn-copy {
        width: 100%;
    }
}

/* Shared Device Styles */
.shared-device {
    border-left: 4px solid var(--accent);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.shared-badge {
    background: var(--accent);
    color: var(--button-text);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    display: inline-block;
    margin-bottom: 8px;
}

.shared-badge i {
    margin-right: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .navbar {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--card-bg);
    margin: 5% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    animation: slideDown 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: var(--button-text);
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    color: var(--button-text);
    margin: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--button-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-body p {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.modal-body .form-group {
    margin-bottom: 1.5rem;
}

.modal-body .form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: block;
}

.modal-body input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

.modal-body small {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: block;
}

.share-info {
    background: rgba(41, 128, 185, 0.1);
    border: 1px solid var(--accent);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.share-info i {
    color: var(--accent);
    margin-top: 0.1rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
}

.modal-actions .btn {
    min-width: 120px;
    padding: 0.75rem 1.5rem;
}

/* Modal Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Open State */
.modal.open {
    display: block;
}

/* Shared Devices List */
.shared-devices-list {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.shared-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.shared-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.btn-unshare {
    background: var(--danger);
    color: var(--button-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-unshare:hover {
    background: #c0392b;
}

/* Form Success/Error Messages in Modal */
.modal .form-error, 
.modal .form-success {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.modal .form-error {
    background: rgba(231, 76, 60, 0.1);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}

.modal .form-success {
    background: rgba(39, 174, 96, 0.1);
    color: var(--success);
    border-left: 4px solid var(--success);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 1.25rem 1.5rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .modal-actions {
        padding: 1.25rem 1.5rem;
        flex-direction: column;
    }
    
    .modal-actions .btn {
        min-width: auto;
        width: 100%;
    }
}

/* Delete Modal Specific Styles */
.delete-warning {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--danger);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.delete-warning i {
    color: var(--danger);
    font-size: 1.2rem;
    margin-top: 0.1rem;
}

.delete-warning p {
    color: var(--text-primary);
    margin: 0;
    font-weight: 600;
}

.delete-consequences {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.delete-consequences p {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.delete-consequences ul {
    color: var(--text-secondary);
    margin: 0;
    padding-left: 1.5rem;
}

.delete-consequences li {
    margin-bottom: 0.5rem;
}

.delete-consequences li:last-child {
    margin-bottom: 0;
}

/* Mobile Navigation Styles */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(41, 128, 185, 0.1);
    color: var(--accent);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-menu-sidebar {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--card-bg);
    z-index: 9999;
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.mobile-menu-sidebar.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: var(--button-text);
}

.mobile-menu-header h3 {
    color: var(--button-text);
    margin: 0;
    font-size: 1.2rem;
}

.mobile-menu-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--button-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.mobile-menu-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.mobile-menu-items {
    flex: 1;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.mobile-nav-item:hover {
    background: var(--bg-secondary);
    border-left-color: var(--accent);
    color: var(--accent);
}

.mobile-nav-item i {
    width: 20px;
    text-align: center;
}

.mobile-nav-welcome {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.5rem;
}

.mobile-nav-logout {
    margin-top: auto;
    background: var(--danger);
    color: var(--button-text) !important;
    border-left-color: var(--danger) !important;
}

.mobile-nav-logout:hover {
    background: #c0392b !important;
    color: var(--button-text) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
    }

    .nav-brand {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .nav-brand h1 {
        font-size: 1.5rem;
        margin: 0;
    }

    .navbar {
        padding: 1rem;
        position: relative;
    }

    /* Adjust container padding for mobile */
    .container {
        padding: 10px;
    }

    /* Ensure modals are properly sized on mobile */
    .modal-content {
        margin: 10% auto;
        width: 95%;
        max-width: none;
    }

    /* Adjust device grid for mobile */
    .devices-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .device-card {
        padding: 1rem;
    }

    .device-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .device-icon {
        align-self: center;
    }

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

    .device-actions .btn {
        min-width: auto;
        width: 100%;
    }

    /* Form adjustments for mobile */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

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

    /* Credential items stack on mobile */
    .credential-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .credential-item label {
        min-width: auto;
    }

    .btn-copy {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .mobile-menu-sidebar {
        width: 85%;
        right: -85%;
    }

    .nav-brand h1 {
        font-size: 1.3rem;
    }

    .card {
        padding: 1.25rem;
    }

    .device-card {
        padding: 0.875rem;
    }

    .modal-content {
        margin: 5% auto;
    }

    .modal-header {
        padding: 1.25rem 1.5rem;
    }

    .modal-body {
        padding: 1.5rem;
    }

    .modal-actions {
        padding: 1.25rem 1.5rem;
        flex-direction: column;
    }

    .modal-actions .btn {
        min-width: auto;
        width: 100%;
    }
        .container .card:first-child h2 {
    font-size: 1.5rem;
}
}

/* Prevent body scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
}

/* Smooth transitions for mobile menu */
.mobile-menu-sidebar,
.mobile-menu-overlay {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal error styling */
.modal-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

.modal-error i {
    font-size: 16px;
    flex-shrink: 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}